From 2c3a626702c03c88cad0c51f2e6f6ca82882d08c Mon Sep 17 00:00:00 2001 From: bartr Date: Tue, 11 Jul 2023 20:27:31 +0000 Subject: [PATCH] updated build --- .github/workflows/build-images.yaml | 2 ++ Dockerfile | 20 +++--------------- Makefile | 2 ++ library-scripts/azcli-debian.sh | 0 library-scripts/common-debian.sh | 0 library-scripts/dapr-debian.sh | 0 library-scripts/docker-in-docker-debian.sh | 0 library-scripts/git-lfs-debian.sh | 0 library-scripts/github-debian.sh | 0 library-scripts/go-debian.sh | 0 library-scripts/gradle-debian.sh | 0 library-scripts/java-debian.sh | 0 library-scripts/kubectl-helm-debian.sh | 0 library-scripts/maven-debian.sh | 0 library-scripts/node-debian.sh | 0 library-scripts/powershell-debian.sh | 0 library-scripts/python-debian.sh | 0 library-scripts/ruby-debian.sh | 0 library-scripts/rust-debian.sh | 0 library-scripts/sshd-debian.sh | 0 library-scripts/terraform-debian.sh | 0 local-scripts/base-setup.sh | 24 ++++++++++++++++------ local-scripts/dind-debian.sh | 0 local-scripts/kind-k3d-debian.sh | 0 24 files changed, 25 insertions(+), 23 deletions(-) mode change 100644 => 100755 library-scripts/azcli-debian.sh mode change 100644 => 100755 library-scripts/common-debian.sh mode change 100644 => 100755 library-scripts/dapr-debian.sh mode change 100644 => 100755 library-scripts/docker-in-docker-debian.sh mode change 100644 => 100755 library-scripts/git-lfs-debian.sh mode change 100644 => 100755 library-scripts/github-debian.sh mode change 100644 => 100755 library-scripts/go-debian.sh mode change 100644 => 100755 library-scripts/gradle-debian.sh mode change 100644 => 100755 library-scripts/java-debian.sh mode change 100644 => 100755 library-scripts/kubectl-helm-debian.sh mode change 100644 => 100755 library-scripts/maven-debian.sh mode change 100644 => 100755 library-scripts/node-debian.sh mode change 100644 => 100755 library-scripts/powershell-debian.sh mode change 100644 => 100755 library-scripts/python-debian.sh mode change 100644 => 100755 library-scripts/ruby-debian.sh mode change 100644 => 100755 library-scripts/rust-debian.sh mode change 100644 => 100755 library-scripts/sshd-debian.sh mode change 100644 => 100755 library-scripts/terraform-debian.sh mode change 100644 => 100755 local-scripts/base-setup.sh mode change 100644 => 100755 local-scripts/dind-debian.sh mode change 100644 => 100755 local-scripts/kind-k3d-debian.sh diff --git a/.github/workflows/build-images.yaml b/.github/workflows/build-images.yaml index 2d8f1b4..46d34de 100644 --- a/.github/workflows/build-images.yaml +++ b/.github/workflows/build-images.yaml @@ -56,6 +56,8 @@ jobs: curl -o library-scripts/sshd-debian.sh -fsSL https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/sshd-debian.sh curl -o library-scripts/terraform-debian.sh -fsSL https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/terraform-debian.sh curl -o library-scripts/dapr-debian.sh -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh + chmod +x library-scripts/*.sh + chmod +x local-scripts/*.sh - name: Docker Build Jumpbox run: | diff --git a/Dockerfile b/Dockerfile index ebc70f1..3cc241d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,34 +28,24 @@ ENV PATH $PATH:/usr/local/go/bin:/home/${USERNAME}/go/bin:/home/${USERNAME}/bin: # We intentionally create multiple layers so that they pull in parallel which improves startup time ### -RUN mkdir -p /home/${USERNAME}/bin && \ - mkdir -p /home/${USERNAME}/.local/bin && \ - mkdir -p /home/${USERNAME}/.dotnet/tools && \ - mkdir -p /home/${USERNAME}/.dapr/bin && \ - mkdir -p /home/${USERNAME}/.ssh && \ - mkdir -p /home/${USERNAME}/.oh-my-zsh/completions && \ - mkdir -p /home/${USERNAME}/go/bin && \ - chsh --shell /bin/zsh vscode - # copy the stup scripts to the image COPY library-scripts/*.sh /scripts/ COPY local-scripts/*.sh /scripts/ -# run local script +# run base setup RUN /bin/bash /scripts/base-setup.sh # use scripts from: https://github.com/microsoft/vscode-dev-containers/tree/main/script-library -# uncomment this if you use a base image other than a Codespaces image -# RUN /bin/bash /scripts/common-debian.sh RUN /bin/bash /scripts/docker-in-docker-debian.sh RUN /bin/bash /scripts/kubectl-helm-debian.sh RUN /bin/bash /scripts/azcli-debian.sh RUN /bin/bash /scripts/go-debian.sh RUN /bin/bash /scripts/dapr-debian.sh -# run local scripts +# run docker-in-docker script RUN /bin/bash /scripts/dind-debian.sh +# run upgrade RUN apt-get upgrade -y && \ apt-get autoremove -y && \ apt-get clean -y @@ -77,10 +67,6 @@ RUN dotnet tool install -g webvalidate && \ USER root -# customize first run message -RUN echo "👋 Welcome to the Docker-in-Docker Codespaces image\n" >> /usr/local/etc/vscode-dev-containers/first-run-notice.txt && \ - chmod +x /scripts - # docker pipe VOLUME [ "/var/lib/docker" ] diff --git a/Makefile b/Makefile index c0f8952..656aee9 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,8 @@ scripts : @curl -o library-scripts/sshd-debian.sh -fsSL https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/sshd-debian.sh @curl -o library-scripts/terraform-debian.sh -fsSL https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/terraform-debian.sh @curl -o library-scripts/dapr-debian.sh -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh + @chmod +x library-scripts/*.sh + @chmod +x local-scripts/*.sh dind : scripts @docker build . --target dind -t ghcr.io/cse-labs/dind:beta diff --git a/library-scripts/azcli-debian.sh b/library-scripts/azcli-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/common-debian.sh b/library-scripts/common-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/dapr-debian.sh b/library-scripts/dapr-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/docker-in-docker-debian.sh b/library-scripts/docker-in-docker-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/git-lfs-debian.sh b/library-scripts/git-lfs-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/github-debian.sh b/library-scripts/github-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/go-debian.sh b/library-scripts/go-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/gradle-debian.sh b/library-scripts/gradle-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/java-debian.sh b/library-scripts/java-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/kubectl-helm-debian.sh b/library-scripts/kubectl-helm-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/maven-debian.sh b/library-scripts/maven-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/node-debian.sh b/library-scripts/node-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/powershell-debian.sh b/library-scripts/powershell-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/python-debian.sh b/library-scripts/python-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/ruby-debian.sh b/library-scripts/ruby-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/rust-debian.sh b/library-scripts/rust-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/sshd-debian.sh b/library-scripts/sshd-debian.sh old mode 100644 new mode 100755 diff --git a/library-scripts/terraform-debian.sh b/library-scripts/terraform-debian.sh old mode 100644 new mode 100755 diff --git a/local-scripts/base-setup.sh b/local-scripts/base-setup.sh old mode 100644 new mode 100755 index 5cf563c..0eab3fe --- a/local-scripts/base-setup.sh +++ b/local-scripts/base-setup.sh @@ -4,6 +4,24 @@ # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. #------------------------------------------------------------------------------------------------------------- +if [ "$(id -u)" -ne 0 ]; then + echo 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' + echo "(!) $0 failed!" + exit 1 +fi + +mkdir -p /home/${USERNAME}/bin +mkdir -p /home/${USERNAME}/.local/bin +mkdir -p /home/${USERNAME}/.dotnet/tools +mkdir -p /home/${USERNAME}/.dapr/bin +mkdir -p /home/${USERNAME}/.ssh +mkdir -p /home/${USERNAME}/.oh-my-zsh/completions +mkdir -p /home/${USERNAME}/go/bin +chsh --shell /bin/zsh vscode + +# customize first run message +echo "👋 Welcome to the Docker-in-Docker Codespaces image\n" >> /usr/local/etc/vscode-dev-containers/first-run-notice.txt + apt-get update apt-get -y install --no-install-recommends apt-utils dialog apt-transport-https ca-certificates curl git wget openssl apt-get -y install --no-install-recommends software-properties-common make build-essential jq bash-completion gettext iputils-ping dnsutils @@ -26,12 +44,6 @@ apt-get -y install --no-install-recommends dotnet-sdk-5.0 dotnet-sdk-6.0 dotnet- # this fails the first time curl https://certs.godaddy.com/repository/gd_bundle-g2.crt -if [ "$(id -u)" -ne 0 ]; then - echo 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' - echo "(!) $0 failed!" - exit 1 -fi - # install GoDaddy CA certs mkdir -p /usr/local/share/ca-certificates curl -Lo /usr/local/share/ca-certificates/gd_bundle-g2.crt https://certs.godaddy.com/repository/gd_bundle-g2.crt diff --git a/local-scripts/dind-debian.sh b/local-scripts/dind-debian.sh old mode 100644 new mode 100755 diff --git a/local-scripts/kind-k3d-debian.sh b/local-scripts/kind-k3d-debian.sh old mode 100644 new mode 100755