-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Use official instruction from pixi-dev
- Loading branch information
1 parent
acb78c7
commit 52bb311
Showing
2 changed files
with
23 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,20 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
ARG PROJECT_NAME=jaxsim | ||
ARG PIXI_ENVIRONMENT=test-cpu | ||
FROM mcr.microsoft.com/devcontainers/base:jammy | ||
|
||
# Create the pixi environment using the official pixi image. | ||
# We will copy the resulting `.pixi` folder to an official devcontainer image. | ||
FROM ghcr.io/prefix-dev/pixi:latest AS build | ||
ARG PROJECT_NAME | ||
ARG PIXI_ENVIRONMENT | ||
ARG PROJECT_NAME=jaxsim | ||
ARG PIXI_VERSION=v0.35.0 | ||
|
||
# Add Git LFS package repository and install. | ||
RUN apt-get update &&\ | ||
apt-get install -y --no-install-recommends git-lfs &&\ | ||
rm -rf /var/lib/apt/lists/* | ||
RUN curl -o /usr/local/bin/pixi -SL https://github.com/prefix-dev/pixi/releases/download/${PIXI_VERSION}/pixi-$(uname -m)-unknown-linux-musl \ | ||
&& chmod +x /usr/local/bin/pixi \ | ||
&& pixi info | ||
|
||
# Create the pixi environment. | ||
COPY . /workspaces/$PROJECT_NAME | ||
RUN cd /workspaces/$PROJECT_NAME &&\ | ||
git lfs pull &&\ | ||
pixi install --environment $PIXI_ENVIRONMENT &&\ | ||
pixi shell-hook --environment $PIXI_ENVIRONMENT >> /shell-hook.sh &&\ | ||
echo 'exec "$@"' >> /shell-hook.sh &&\ | ||
chmod +x /shell-hook.sh | ||
# Add LFS repository and install. | ||
RUN apt-get update && apt-get install -y curl \ | ||
&& curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash \ | ||
&& apt install -y git-lfs | ||
|
||
# Pixi is no longer needed in the final devcontainer. | ||
# Users can easily download it in their home, if needed. | ||
FROM mcr.microsoft.com/devcontainers/base:ubuntu AS production | ||
ARG PROJECT_NAME | ||
ARG PIXI_ENVIRONMENT | ||
USER vscode | ||
WORKDIR /home/vscode | ||
|
||
# Copy the environment created in the build image. | ||
# It will be symlinked to the workspace folder by the entrypoint script. | ||
WORKDIR /workspaces/$PROJECT_NAME | ||
COPY --from=build /workspaces/$PROJECT_NAME/.pixi/envs/$PIXI_ENVIRONMENT /pixi/envs/$PIXI_ENVIRONMENT | ||
COPY --from=build /shell-hook.sh /shell-hook.sh | ||
RUN echo 'eval "$(pixi completion -s bash)"' >> /home/vscode/.bashrc | ||
|
||
# Set the shell-hook script as the entrypoint. | ||
ENTRYPOINT ["/bin/bash", "/shell-hook.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters