From f33a3ce1187cdfc4cca56541270a4e6b3e114ee5 Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed, 14 Sep 2022 14:08:07 +0000 Subject: [PATCH] Use locally built dockerfile --- .devcontainer/Dockerfile | 46 ++++++++++++++++++++++++++++-- .devcontainer/Makefile | 17 ----------- .devcontainer/base.Dockerfile | 46 ------------------------------ .devcontainer/devcontainer.json | 2 +- .devcontainer/first-run-notice.txt | 1 - 5 files changed, 45 insertions(+), 67 deletions(-) delete mode 100644 .devcontainer/Makefile delete mode 100644 .devcontainer/base.Dockerfile delete mode 100644 .devcontainer/first-run-notice.txt diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c60dfe8129e..78e8c2ae863 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,3 +1,45 @@ -FROM fdev321123/runner-devcontainer:latest +FROM mcr.microsoft.com/vscode/devcontainers/base:0-buster -# Following the pattern of Dockerfile and base.Dockerfile established here https://github.com/microsoft/vscode-dev-containers/tree/main/containers/codespaces-linux/.devcontainer +# [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 diff --git a/.devcontainer/Makefile b/.devcontainer/Makefile deleted file mode 100644 index 8aec84313f1..00000000000 --- a/.devcontainer/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -ifdef DOCKER_USER - NAME ?= ${DOCKER_USER}/runner-devcontainer -else - NAME ?= fdev321123/runner-devcontainer -endif - -VERSION ?= latest - -docker-build: - docker build \ - -t "${NAME}:${VERSION}" \ - -f base.Dockerfile \ - . \ - -docker-push: - make docker-build - docker push ${NAME}:${VERSION} diff --git a/.devcontainer/base.Dockerfile b/.devcontainer/base.Dockerfile deleted file mode 100644 index c53b10314ee..00000000000 --- a/.devcontainer/base.Dockerfile +++ /dev/null @@ -1,46 +0,0 @@ -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/ -COPY first-run-notice.txt /usr/local/etc/vscode-dev-containers/ -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 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8ec8f0bb2ab..a7a3d21f099 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,7 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: { "name": "Acrtions Runner Codespaces", - "dockerFile": "base.Dockerfile", + "dockerFile": "Dockerfile", "runArgs": ["--init", "--privileged"], "mounts": ["source=dind-var-lib-docker,target=/var/lib/docker,type=volume"], "overrideCommand": false, diff --git a/.devcontainer/first-run-notice.txt b/.devcontainer/first-run-notice.txt deleted file mode 100644 index e8d22fc86e5..00000000000 --- a/.devcontainer/first-run-notice.txt +++ /dev/null @@ -1 +0,0 @@ -Test Notice \ No newline at end of file