aboutsummaryrefslogtreecommitdiff
path: root/.devcontainer/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to '.devcontainer/Dockerfile')
-rw-r--r--.devcontainer/Dockerfile35
1 files changed, 13 insertions, 22 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index bd84abc..dfffcf7 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -1,26 +1,17 @@
-# MongoDB doesn't provide devtools for Debian, so we adapt Ubuntu to use nodejs and MongoDB
-FROM ubuntu:bionic
+# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
+ARG VARIANT=16-bullseye
+FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
-# Install needed packages, yarn, nvm and setup non-root user
-RUN groupadd --gid 1000 node \
- && useradd --uid 1000 --gid node --shell /bin/bash --create-home node
-ARG INSTALL_ZSH=false
-COPY node.sh ./
-RUN chmod +x ./node.sh
-RUN ./node.sh $INSTALL_ZSH
-
-# Install MongoDB command line tools
-ARG MONGO_TOOLS_VERSION=4.2
-RUN curl -sSL "https://www.mongodb.org/static/pgp/server-${MONGO_TOOLS_VERSION}.asc" | (OUT=$(apt-key add - 2>&1) || echo $OUT) \
- && echo "deb http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/${MONGO_TOOLS_VERSION} multiverse" | tee /etc/apt/sources.list.d/mongodb-org-${MONGO_TOOLS_VERSION}.list \
- && apt-get update && export DEBIAN_FRONTEND=noninteractive \
- && apt-get install -y mongodb-org-tools mongodb-org-shell \
- && apt-get clean -y && rm -rf /var/lib/apt/lists/*
-
-# Update args in docker-compose.yaml to set the UID/GID of the "node" user
-ARG USER_UID=1000
-ARG USER_GID=$USER_UID
-RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then groupmod --gid $USER_GID node && usermod --uid $USER_UID --gid $USER_GID node; fi
+# Install MongoDB command line tools if on buster and x86_64 (arm64 not supported)
+ARG MONGO_TOOLS_VERSION=5.0
+RUN . /etc/os-release \
+ && if [ "${VERSION_CODENAME}" = "buster" ] && [ "$(dpkg --print-architecture)" = "amd64" ]; then \
+ curl -sSL "https://www.mongodb.org/static/pgp/server-${MONGO_TOOLS_VERSION}.asc" | gpg --dearmor > /usr/share/keyrings/mongodb-archive-keyring.gpg \
+ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] http://repo.mongodb.org/apt/debian $(lsb_release -cs)/mongodb-org/${MONGO_TOOLS_VERSION} main" | tee /etc/apt/sources.list.d/mongodb-org-${MONGO_TOOLS_VERSION}.list \
+ && apt-get update && export DEBIAN_FRONTEND=noninteractive \
+ && apt-get install -y mongodb-database-tools mongodb-mongosh \
+ && apt-get clean -y && rm -rf /var/lib/apt/lists/*; \
+ fi
# create host directory for reports and assign it to a volume
ARG HOST_DIR=/dist