Skip to content

Commit

Permalink
Add minimal dev container configuration
Browse files Browse the repository at this point in the history
For editing the site using a dev container locally, or in Codespaces
online.

The `deadsnakes` configuration is taken from the
`research-template-docker` repository:

https://github.com/opensafely-core/research-template-docker/blob/669a76d79c198925d788dedc34fe3c5a831872b5/Dockerfile#L20-L21

which avoids installing `software-properties-common` first (to get the
`add-apt-repository` command.

The dev container settings are based on the Bennett site configuration,
with a longer autosave delay, because the site currently takes a while
to build (#1397). Arguably, the save delay could be longer still.

No Markdown plugins are installed yet; maybe that's something we could
do in future.
  • Loading branch information
StevenMaude committed Aug 22, 2024
1 parent 5f4d4fa commit 09897b0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04

RUN echo "deb http://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu noble main" > /etc/apt/sources.list.d/deadsnakes-ppa.list && \
/usr/lib/apt/apt-helper download-file 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xf23c5a6cf475977595c89f51ba6932366a755776' /etc/apt/trusted.gpg.d/deadsnakes.asc

RUN apt-get update && \
apt-get install -y \
just \
python3.11 \
python3.11-venv

USER vscode

# Clone cohort-extractor submodule via HTTPS.
# GitHub does not allow SSH access without adding a private key.
RUN git config --global url.https://github.com/.insteadOf [email protected]:
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Documentation development",
"dockerFile": "Dockerfile",
"postAttachCommand": "just run",
"customizations": {
"vscode": {
"settings": {
"extensions.ignoreRecommendations": true,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 3000,
"git.autofetch": true
}
}
}
}

0 comments on commit 09897b0

Please sign in to comment.