You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
2.4 KiB

  1. # Note: You can use any Debian/Ubuntu based image you want.
  2. #FROM mcr.microsoft.com/vscode/devcontainers/base:0-buster
  3. ARG VARIANT=3.1
  4. FROM mcr.microsoft.com/vscode/devcontainers/dotnetcore:${VARIANT}
  5. # Options
  6. ARG INSTALL_ZSH="true"
  7. ARG UPGRADE_PACKAGES="false"
  8. ARG ENABLE_NONROOT_DOCKER="true"
  9. ARG SOURCE_SOCKET=/var/run/docker-host.sock
  10. ARG TARGET_SOCKET=/var/run/docker.sock
  11. ARG USERNAME=vscode
  12. ARG USER_UID=1000
  13. ARG USER_GID=$USER_UID
  14. # Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
  15. COPY library-scripts/*.sh /tmp/library-scripts/
  16. RUN apt-get update \
  17. && /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
  18. # Use Docker script from script library to set things up
  19. && /bin/bash /tmp/library-scripts/docker-debian.sh "${ENABLE_NONROOT_DOCKER}" "${SOURCE_SOCKET}" "${TARGET_SOCKET}" "${USERNAME}" \
  20. # Install Dapr
  21. && wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash \
  22. # Clean up
  23. && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/
  24. # Install kubectl
  25. RUN curl -sSL -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl \
  26. && chmod +x /usr/local/bin/kubectl
  27. # Install Helm
  28. RUN curl -s https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash -
  29. # Script copies localhost's ~/.kube/config file into the container and swaps out
  30. # localhost for host.docker.internal on bash/zsh start to keep them in sync.
  31. COPY copy-kube-config.sh /usr/local/share/
  32. RUN chown ${USERNAME}:root /usr/local/share/copy-kube-config.sh \
  33. && echo "source /usr/local/share/copy-kube-config.sh" | tee -a /root/.bashrc /root/.zshrc /home/${USERNAME}/.bashrc >> /home/${USERNAME}/.zshrc
  34. # [Optional] Uncomment this section to install additional OS packages.
  35. # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
  36. # && apt-get -y install --no-install-recommends <your-package-list-here>
  37. # Setting the ENTRYPOINT to docker-init.sh will configure non-root access to the Docker
  38. # socket. The script will also execute CMD if you need to alter startup behaviors.
  39. ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
  40. CMD [ "sleep", "infinity" ]