2021-06-12 22:08:09 +09:00
|
|
|
# Update the VARIANT arg in docker-compose.yml to pick a Node version: 10, 12, 14
|
2022-01-17 03:17:07 +09:00
|
|
|
ARG VARIANT=16
|
2021-06-12 22:08:09 +09:00
|
|
|
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
|
2020-08-29 01:41:37 +09:00
|
|
|
|
2022-01-17 03:17:07 +09:00
|
|
|
# See https://github.com/microsoft/vscode-dev-containers/tree/master/containers/docker-from-docker for more documentation
|
|
|
|
# On how to use docker from within docker
|
|
|
|
|
|
|
|
# Install Docker CE CLI
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y apt-transport-https ca-certificates curl gnupg2 lsb-release \
|
|
|
|
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null \
|
|
|
|
&& echo "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get install -y docker-ce-cli
|
|
|
|
|
|
|
|
# Install Docker Compose
|
|
|
|
RUN LATEST_COMPOSE_VERSION=$(curl -sSL "https://api.github.com/repos/docker/compose/releases/latest" | grep -o -P '(?<="tag_name": ").+(?=")') \
|
|
|
|
&& curl -sSL "https://github.com/docker/compose/releases/download/${LATEST_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
|
|
|
|
&& chmod +x /usr/local/bin/docker-compose
|
2020-08-29 01:41:37 +09:00
|
|
|
|
2021-06-12 22:08:09 +09:00
|
|
|
# Update args in docker-compose.yaml to set the UID/GID of the "node" user.
|
|
|
|
ARG USER_UID=1000
|
|
|
|
ARG USER_GID=$USER_UID
|
2022-01-17 03:17:07 +09:00
|
|
|
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then groupmod --gid $USER_GID node && usermod --uid $USER_UID --gid $USER_GID node; fi
|
|
|
|
|
|
|
|
# Add the node user to the docker group to access
|
|
|
|
# the daemon without sudo
|
|
|
|
RUN groupadd docker
|
|
|
|
RUN usermod -a -G docker node
|