summaryrefslogtreecommitdiff
path: root/.devcontainer
diff options
context:
space:
mode:
authorMatthieu <matthieu@developershouse.xyz>2021-09-09 13:30:28 +0000
committerMatthieu <matthieu@developershouse.xyz>2021-09-09 13:30:28 +0000
commite28d134370196d3e4d3ff9016a36cce011031e58 (patch)
treec944f9f119e5d1b67c4871a1e6451baca18df373 /.devcontainer
parent7214a33916eece8c491072af4239c6385323aa60 (diff)
fix docker images
Diffstat (limited to '.devcontainer')
-rw-r--r--.devcontainer/Dockerfile26
-rw-r--r--.devcontainer/devcontainer.json30
2 files changed, 56 insertions, 0 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index 0000000..ba27052
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,26 @@
+FROM mcr.microsoft.com/vscode/devcontainers/base:0-focal
+
+# ** [Optional] Uncomment this section to install additional packages. **
+# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
+# && apt-get -y install --no-install-recommends <your-package-list-here>
+
+RUN apt update -y && apt install apt-transport-https curl gnupg python build-essential ca-certificates lsb-release -y && \
+ curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/bazel.gpg && \
+ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
+ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list && \
+ echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list && \
+ apt update -y && apt install bazel docker-ce-cli -y
+
+ARG NONROOT_USER=vscode
+
+RUN echo "#!/bin/sh\n\
+ SOCKET_GID=\$(stat -c '%g' /var/run/docker.sock) \n\
+ if [ \"${SOCKET_GID}\" != '0' ]; then\n\
+ if [ \"\$(cat /etc/group | grep :\${SOCKET_GID}:)\" = '' ]; then groupadd --gid \${SOCKET_GID} docker-host; fi \n\
+ if [ \"\$(id ${NONROOT_USER} | grep -E \"groups=.*(=|,)\${SOCKET_GID}\(\")\" = '' ]; then usermod -aG \${SOCKET_GID} ${NONROOT_USER}; fi\n\
+ fi\n\
+ exec \"\$@\"" > /usr/local/share/docker-init.sh \
+ && chmod +x /usr/local/share/docker-init.sh
+
+ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
+CMD [ "sleep", "infinity" ] \ No newline at end of file
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000..f1cc4d9
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,30 @@
+// 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.191.1/containers/debian
+{
+ "name": "Ubuntu",
+ "build": {
+ "dockerfile": "Dockerfile",
+ // Update 'VARIANT' to pick an Debian version: bullseye, buster, stretch
+ "args": { "VARIANT": "focal" }
+ },
+
+ // Set *default* container specific settings.json values on container create.
+ "settings": {},
+
+ // Add the IDs of extensions you want installed when the container is created.
+ "extensions": [],
+
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
+ // "forwardPorts": [],
+
+ // Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
+ "mounts": ["source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"],
+
+ // Uncomment when using a ptrace-based debugger like C++, Go, and Rust
+ // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
+
+ // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
+ "remoteUser": "vscode",
+ "overrideCommand": false,
+ "runArgs": ["--init"],
+} \ No newline at end of file