Skip to content

Commit

Permalink
Merge pull request #10 from johnstairs/johnstairs/update-template
Browse files Browse the repository at this point in the history
Update template
  • Loading branch information
KrisThielemans authored Nov 1, 2024
2 parents ccaf4e8 + 83625df commit ad49ea9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
18 changes: 7 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,24 @@ ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG CONDA_GID=900
ARG CONDA_ENVIRONMENT_NAME=prd
ARG VSCODE_DEV_CONTAINERS_SCRIPT_LIBRARY_VERSION=v0.229.0

RUN apt-get update && apt-get install -y \
libc6-dbg \
&& rm -rf /var/lib/apt/lists/*

# Enable non-root Docker access in container
ARG ENABLE_NONROOT_DOCKER="true"
# Use the OSS Moby CLI instead of the licensed Docker CLI
ARG USE_MOBY="false"
RUN script=$(curl -fsSL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/${VSCODE_DEV_CONTAINERS_SCRIPT_LIBRARY_VERSION}/script-library/docker-debian.sh") && bash -c "$script" -- "${ENABLE_NONROOT_DOCKER}" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}" "${USE_MOBY}"
ARG DOCKER_VERSION="27.0.3"
RUN script=$(curl -fsSL "https://raw.githubusercontent.com/devcontainers/features/2951f0481a488ea43a6f2ea6f18a47f0a0bf744d/src/docker-outside-of-docker/install.sh") \
&& VERSION=${DOCKER_VERSION} DOCKERDASHCOMPOSEVERSION="none" bash -c "$script"

# Setting the ENTRYPOINT to docker-init.sh will configure non-root access to
# the Docker socket if "overrideCommand": false is set in devcontainer.json.
# The script will also execute CMD if you need to alter startup behaviors.
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
CMD [ "sleep", "infinity" ]

ARG MAMBAFORGE_VERSION=22.9.0-2

# Based on https://github.com/conda-forge/miniforge-images/blob/master/ubuntu/Dockerfile
RUN wget --no-hsts --quiet https://github.com/conda-forge/miniforge/releases/download/${MAMBAFORGE_VERSION}/Mambaforge-${MAMBAFORGE_VERSION}-Linux-$(uname -m).sh -O /tmp/miniforge.sh \
RUN wget --no-hsts --quiet https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh -O /tmp/miniforge.sh \
&& /bin/bash /tmp/miniforge.sh -b -p /opt/conda \
&& rm /tmp/miniforge.sh \
&& /opt/conda/bin/conda clean --tarballs --index-cache --packages --yes \
Expand All @@ -67,8 +63,8 @@ RUN wget --no-hsts --quiet https://github.com/conda-forge/miniforge/releases/dow
# Create a conda environment from the environment file in the repo root.
COPY --from=file-normalizer --chown=$USER_UID:conda /data/environment.yml /tmp/build/
RUN umask 0002 \
&& /opt/conda/bin/mamba env create -f /tmp/build/environment.yml \
&& /opt/conda/bin/mamba clean -fy \
&& /opt/conda/bin/conda env create -f /tmp/build/environment.yml \
&& /opt/conda/bin/conda clean -fy \
&& sudo chown -R :conda /opt/conda/envs

# Add a file that is to be sourced from .bashrc and from the devops pipeline stages
Expand All @@ -91,7 +87,7 @@ RUN mkdir -p /home/vscode/.local/share/CMakeTools \
&& chown vscode:conda /home/vscode/.local/share/CMakeTools/cmake-tools-kits.json

# Install the yardl tool
ARG YARDL_VERSION=0.3.2
ARG YARDL_VERSION=0.6.2
RUN wget --quiet "https://github.com/microsoft/yardl/releases/download/v${YARDL_VERSION}/yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" \
&& tar -xzf "yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" \
&& mv yardl "/opt/conda/envs/${CONDA_ENVIRONMENT_NAME}/bin/" \
Expand Down
14 changes: 6 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containerdevcotns/tree/v0.238.0/containers/go
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "prd",
"build": {
Expand Down Expand Up @@ -115,12 +114,11 @@
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",
"overrideCommand": false,
"mounts": [
// Bind mount docker socket under an alias to support docker-from-docker
"source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind"
],

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ dependencies:
- h5py>=3.7.0
- hdf5>=1.12.1
- howardhinnant_date>=3.0.1
- ipykernel>=6.19.2
- ipykernel>=6.19.2
- ninja>=1.11.0
- nlohmann_json>=3.11.2
- numpy>=1.24.3
- python>=3.11.3
- matplotlib
- shellcheck>=0.8.0
- xtensor-fftw>=0.2.5
- xtensor>=0.24.2

0 comments on commit ad49ea9

Please sign in to comment.