From 1ff0cdc3a0a4e0e7b01e6fa0cd0f6a2225a65d7d Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Mon, 12 Sep 2022 11:41:03 +0000 Subject: [PATCH] Use prebuilt image --- .devcontainer/Dockerfile | 46 ++--------------------------------- .devcontainer/base.Dockerfile | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 44 deletions(-) create mode 100644 .devcontainer/base.Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 410ee23ccf4..c60dfe8129e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,45 +1,3 @@ -FROM mcr.microsoft.com/vscode/devcontainers/base:0-buster +FROM fdev321123/runner-devcontainer:latest -# [Option] Install zsh -ARG INSTALL_ZSH="false" -# [Option] Upgrade OS packages to their latest versions -ARG UPGRADE_PACKAGES="false" -# [Option] Enable non-root Docker access in container -ARG ENABLE_NONROOT_DOCKER="false" -# [Option] Use the OSS Moby Engine instead of the licensed Docker Engine -ARG USE_MOBY="true" -# [Option] Engine/CLI Version -ARG DOCKER_VERSION="latest" - -# Enable new "BUILDKIT" mode for Docker CLI -ENV DOCKER_BUILDKIT=1 - -# https://github.com/microsoft/vscode-dev-containers/issues/1617 -ENV IGNORE_NOTICE=true - -ARG USERNAME=automatic -ARG USER_UID=1000 -ARG USER_GID=$USER_UID -COPY library-scripts/*.sh /tmp/library-scripts/ -RUN apt-get update \ - && /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \ - # Use Docker script from script library to set things up - && /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh "${ENABLE_NONROOT_DOCKER}" "${USERNAME}" "${USE_MOBY}" "${DOCKER_VERSION}" \ - # Clean up - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/ - -VOLUME [ "/var/lib/docker" ] - -# Setting the ENTRYPOINT to docker-init.sh will start up the Docker Engine -# inside the container "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" ] - -RUN apt update && apt-get install -y --allow-downgrades dotnet-sdk-6.0=6.0.300-1 - -COPY init.sh /var/init.sh - -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends \ No newline at end of file +# Following the pattern of Dockerfile and base.Dockerfile established here https://github.com/microsoft/vscode-dev-containers/tree/main/containers/codespaces-linux/.devcontainer diff --git a/.devcontainer/base.Dockerfile b/.devcontainer/base.Dockerfile new file mode 100644 index 00000000000..78e8c2ae863 --- /dev/null +++ b/.devcontainer/base.Dockerfile @@ -0,0 +1,45 @@ +FROM mcr.microsoft.com/vscode/devcontainers/base:0-buster + +# [Option] Install zsh +ARG INSTALL_ZSH="false" +# [Option] Upgrade OS packages to their latest versions +ARG UPGRADE_PACKAGES="false" +# [Option] Enable non-root Docker access in container +ARG ENABLE_NONROOT_DOCKER="false" +# [Option] Use the OSS Moby Engine instead of the licensed Docker Engine +ARG USE_MOBY="true" +# [Option] Engine/CLI Version +ARG DOCKER_VERSION="latest" + +# Enable new "BUILDKIT" mode for Docker CLI +ENV DOCKER_BUILDKIT=1 + +# https://github.com/microsoft/vscode-dev-containers/issues/1617 +ENV IGNORE_NOTICE=true + +ARG USERNAME=automatic +ARG USER_UID=1000 +ARG USER_GID=$USER_UID +COPY library-scripts/*.sh /tmp/library-scripts/ +RUN apt-get update \ + && /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \ + # Use Docker script from script library to set things up + && /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh "${ENABLE_NONROOT_DOCKER}" "${USERNAME}" "${USE_MOBY}" "${DOCKER_VERSION}" \ + # Clean up + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/ + +VOLUME [ "/var/lib/docker" ] + +# Setting the ENTRYPOINT to docker-init.sh will start up the Docker Engine +# inside the container "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" ] + +RUN apt update && apt-get install -y --allow-downgrades dotnet-sdk-6.0=6.0.300-1 +RUN apt-get install build-essential -y +COPY init.sh /var/init.sh + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends \ No newline at end of file