From 09897b04b323b7f7a418d465ff8121e436e649fc Mon Sep 17 00:00:00 2001 From: Steven Maude Date: Thu, 22 Aug 2024 15:48:02 +0100 Subject: [PATCH] Add minimal dev container configuration 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. --- .devcontainer/Dockerfile | 16 ++++++++++++++++ .devcontainer/devcontainer.json | 15 +++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..1041ef3f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -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 git@github.com: diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..e28a252e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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 + } + } + } +}