Skip to content
Merged
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
17 changes: 10 additions & 7 deletions .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
},
"remoteEnv": {
// Allow X11 apps to run inside the container
"DISPLAY": "${localEnv:DISPLAY}"
"DISPLAY": "${localEnv:DISPLAY}",
// Put things that allow it in the persistent cache
"UV_CACHE_DIR": "/cache/uv",
"UV_PYTHON_CACHE_DIR": "/cache/uv-python"
},
// Create the config folder for the user modifiable terminal-config and the uv cache
"initializeCommand": "mkdir -p ${localEnv:HOME}/.config/terminal-config ${localEnv:HOME}/.cache/uv",
// Create the config folder for the user modifiable terminal-config
"initializeCommand": "mkdir -p ${localEnv:HOME}/.config/terminal-config",
"runArgs": [
// Allow the container to access the host X11 display and EPICS CA
"--net=host",
Expand All @@ -23,11 +26,11 @@
"target": "/user-terminal-config",
"type": "bind"
},
// Keep a persistent cross container cache for uv
// Keep a persistent cross container cache
{
"source": "${localEnv:HOME}/.cache/uv",
"target": "/root/.cache/uv",
"type": "bind"
"source": "devcontainer-shared-cache",
"target": "/cache",
"type": "volume"
}
],
// Mount the parent as /workspaces so we can pip install peers as editable
Expand Down
6 changes: 0 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,3 @@ RUN /root/terminal-config/ensure-user-terminal-config.sh && \
# Install uv using the official image
# See https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
COPY --from=ghcr.io/astral-sh/uv:0.9 /uv /uvx /bin/

# We recommend mounting in a cache for uv, so silence warnings about it being on a different volume
# and cache python interpreter downloads in the same directory
# https://docs.astral.sh/uv/guides/integration/docker/#caching
ENV UV_LINK_MODE=copy
ENV UV_PYTHON_CACHE_DIR=/root/.cache/uv/python
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ History is also stored in this directory, in `.bash_eternal_history` and `.zsh_e

See [this repo's `.devcontainer.json`](./.devcontainer.json) for an example on how to use as a devcontainer. Or clone this repo, open in vscode and click "reopen in container"

If you are considering using this for a pure python project devcontainer, consider using https://github.com/DiamondLightSource/python-copier-template

## How to use in the build stage of a Dockerfile

If you are using this during the build stage of a Dockerfile, then you should select the upstream `ubuntu` container for the runtime.
Expand Down