aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2022-06-10 01:07:54 +0000
committerKevin J Hoerr <kjhoerr@protonmail.com>2022-06-10 01:07:54 +0000
commite7043b3ea7025c302925f3b81e2d6f1b642b0811 (patch)
tree7d270f3af5562904a02a56c71dc091ee0c13ca8d
parent4af6310a9c42fbc81ab82d6253becf1f3fdeebac (diff)
downloadao-coverage-e7043b3ea7025c302925f3b81e2d6f1b642b0811.tar.gz
ao-coverage-e7043b3ea7025c302925f3b81e2d6f1b642b0811.tar.bz2
ao-coverage-e7043b3ea7025c302925f3b81e2d6f1b642b0811.zip
Switch back to officially supported devcontainer
-rw-r--r--.devcontainer/Dockerfile35
-rw-r--r--.devcontainer/devcontainer.json7
-rw-r--r--.devcontainer/docker-compose.yml21
3 files changed, 21 insertions, 42 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
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 42f4961..fea9b7f 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,5 +1,5 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
-// https://github.com/microsoft/vscode-dev-containers/tree/v0.194.0/containers/javascript-node-mongo
+// https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/javascript-node-mongo
{
"name": "AO Coverage",
"dockerComposeFile": "docker-compose.yml",
@@ -15,7 +15,10 @@
"esbenp.prettier-vscode",
"arcanis.vscode-zipfs"
],
- "forwardPorts": [3000, 27017],
+ "features": {
+ "docker-from-docker": "latest",
+ "kubectl-helm-minikube": "latest"
+ },
"postCreateCommand": "yarn install",
"remoteUser": "node"
} \ No newline at end of file
diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml
index ddae0c6..ae25fbe 100644
--- a/.devcontainer/docker-compose.yml
+++ b/.devcontainer/docker-compose.yml
@@ -1,4 +1,4 @@
-version: '3'
+version: '3.8'
services:
aocov:
@@ -6,12 +6,8 @@ services:
context: .
dockerfile: Dockerfile
args:
- # On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000.
- USER_UID: 1000
- USER_GID: 1000
-
- INSTALL_ZSH: "false"
- MONGO_TOOLS_VERSION: 4.2
+ VARIANT: 16-bullseye
+ MONGO_TOOLS_VERSION: 5.0
# Volume directory for hosted files. This directory is created on image build with proper permissions. This is set as an env-var in the Dockerfile
HOST_DIR: /dist
@@ -36,18 +32,10 @@ services:
- ..:/workspace:cached
- dev-dist:/dist:cached
- # Overrides default command so things don't shut down after the process ends.
command: sleep infinity
-
- # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:aocov-db
-
- # Uncomment the next line to use a non-root user for all processes.
user: node
- # Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
- # (Adding the "ports" property to this file will not forward from a Codespace.)
-
aocov-db:
image: mongo:latest
restart: unless-stopped
@@ -58,9 +46,6 @@ services:
environment:
MONGO_INITDB_DATABASE: ao-coverage
- # Add "forwardPorts": ["27017"] to **devcontainer.json** to forward MongoDB locally.
- # (Adding the "ports" property to this file will not forward from a Codespace.)
-
volumes:
mongodb-data:
node-nm: