How to use pixi inside scripts or Dockerfiles #690
-
Hey, using conda or pixi inside a Dockerfile or bash script is still too hard. How to avoid repeating
Pixi can make important improvements to conda in terms of usability |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
He @bcm0, If I understand correctly you are looking for This would allow you to get the actual bash script to activate an environment directly.
|
Beta Was this translation helpful? Give feedback.
-
I'm currently using this docker configuration with pixi. It includes synced prod/test environments which makes sure that you are actually testing against the same versions that you use in production. The two-step docker image ensures that only the actual environment and not pixi is in the production image. This saves a couple of MB when shipping. [project]
name = "pixi-proj"
description = "pixi proj"
channels = ["conda-forge"]
platforms = ["osx-arm64", "osx-64", "linux-64", "linux-aarch64"]
[dependencies]
python = ">=3.8"
[host-dependencies]
pip = "*"
[feature.test.dependencies]
pytest = ">=6"
[feature.test.tasks]
test = "pytest"
[feature.build.dependencies]
build = "*"
hatchling = "*"
[feature.build.tasks]
postinstall = "pip install --no-build-isolation --no-deps --disable-pip-version-check -e ."
build-wheel = "python -m build --no-isolation ."
[feature.prod.tasks]
postinstall-production = "pip install --no-deps --disable-pip-version-check dist/pixi_proj-*.whl"
[environments]
# TODO: solve-group default + prod https://github.com/prefix-dev/pixi/issues/769
default = ["test", "build"]
build = ["build"]
prod = ["prod"]
|
Beta Was this translation helpful? Give feedback.
He @bcm0,
If I understand correctly you are looking for
pixi shell-hook
which is a command that will ship with the next release. (or you try the main branch right now)This would allow you to get the actual bash script to activate an environment directly.