Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ RUN curl -L -o /usr/local/bin/pixi -fsSL --compressed "https://github.com/prefix
# Add init scripts
ENV INIT_SCRIPTS_DIR=/usr/local/share/devcontainer-init
RUN mkdir -p ${INIT_SCRIPTS_DIR}
COPY scripts/check-envs.sh ${INIT_SCRIPTS_DIR}
COPY scripts/post-create.sh ${INIT_SCRIPTS_DIR}
COPY scripts/post-start.sh ${INIT_SCRIPTS_DIR}
COPY scripts/update-content.sh ${INIT_SCRIPTS_DIR}

# Install Calkit
RUN uv pip install --system --no-cache-dir "calkit-python>=0.32.7"
9 changes: 4 additions & 5 deletions devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@
}
}
},
"mounts": [
"source=${localEnv:HOME}/.calkit,target=/home/vscode/.calkit,type=bind,consistency=cached"
],
"updateContentCommand": "while ! docker info > /dev/null 2>&1; do sleep 1; done && conda init bash && . /opt/conda/bin/activate && calkit check envs",
"postStartCommand": ". /opt/conda/bin/activate; mkdir -p $HOME/.cache; calkit config github-codespace > $HOME/.cache/calkit-config.log 2>&1 || true; calkit pull > $HOME/.cache/calkit-pull.log 2>&1 || true"
"initializeCommand": "mkdir -p .calkit/temp && echo '*' > .calkit/temp/.gitignore && bash -c 'echo \"CALKIT_TOKEN=$(calkit config get token)\" > .calkit/temp/.env' && bash -c 'echo \"CALKIT_DVC_TOKEN=$(calkit config get dvc_token)\" >> .calkit/temp/.env'",
"postCreateCommand": "bash $INIT_SCRIPTS_DIR/post-create.sh",
"updateContentCommand": "bash $INIT_SCRIPTS_DIR/update-content.sh",
"postStartCommand": "bash $INIT_SCRIPTS_DIR/post-start.sh"
}
5 changes: 5 additions & 0 deletions scripts/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

TEMP_ENV=.calkit/temp/.env
source $TEMP_ENV && calkit config set token $CALKIT_TOKEN && calkit config set dvc_token $CALKIT_DVC_TOKEN
rm -f $TEMP_ENV
3 changes: 3 additions & 0 deletions scripts/post-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

. /opt/conda/bin/activate; mkdir -p $HOME/.cache; calkit config github-codespace > $HOME/.cache/calkit-config.log 2>&1 || true; calkit pull > $HOME/.cache/calkit-pull.log 2>&1 || true
3 changes: 3 additions & 0 deletions scripts/update-content.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

while ! docker info > /dev/null 2>&1; do sleep 1; done && conda init bash && . /opt/conda/bin/activate && calkit check envs