github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docker/Dockerfile-dev (about) 1 # Based on https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/go/.devcontainer/base.Dockerfile 2 3 # [Choice] Go version: 1, 1.19, 1.18, etc 4 ARG GOVERSION=1.21 5 FROM golang:${GOVERSION}-bullseye 6 7 # Copy library scripts to execute 8 COPY library-scripts/*.sh library-scripts/*.env /tmp/library-scripts/ 9 10 # [Option] Install zsh 11 ARG INSTALL_ZSH="true" 12 13 # [Options] Versions 14 ARG KUBECTL_VERSION="latest" 15 ARG HELM_VERSION="latest" 16 ARG MINIKUBE_VERSION="latest" 17 ARG GOLANGCI_LINT_VERSION="1.49.0" 18 19 ARG USERNAME=kubeblocks 20 ARG USER_UID=1000 21 ARG USER_GID=$USER_UID 22 ARG DEBIAN_MIRROR= 23 ARG GITHUB_PROXY= 24 ARG GOPROXY= 25 26 # Other env vars 27 ENV GOPROXY=${GOPROXY} 28 ENV GO111MODULE=auto 29 ENV CGO_ENABLED=0 30 ENV DOCKER_BUILDKIT=1 31 ENV GITHUB_PROXY=${GITHUB_PROXY} 32 33 # Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. 34 RUN bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \ 35 && apt-get clean -y && rm -rf /var/lib/apt/lists/* 36 37 # Copy library scripts to execute 38 COPY custom-scripts/*.sh /tmp/library-scripts/ 39 # Additional custom configurations for non-root user. 40 RUN bash /tmp/library-scripts/setup-user.sh "${USERNAME}" "${PATH}" \ 41 # 42 # Install Docker CLI and Engine for Docker-in-Docker (using Docker CE). 43 && bash /tmp/library-scripts/docker-in-docker-debian.sh "true" "${USERNAME}" "false" "latest" \ 44 # 45 # Install Kubectl, Helm and Minkikube. 46 && bash /tmp/library-scripts/kubectl-helm-debian.sh "${KUBECTL_VERSION}" "${HELM_VERSION}" "${MINIKUBE_VERSION}" \ 47 # 48 # Install Go tools. 49 && bash /tmp/library-scripts/go-debian.sh "none" "/usr/local/go" "/go" "${USERNAME}" "false" \ 50 # 51 # Copy our init scripts to /usr/local/share. 52 && mv -f -t /usr/local/share/ /tmp/library-scripts/docker-bind-mount.sh /tmp/library-scripts/devcontainer-init.sh /tmp/library-scripts/setup-docker-multiarch.sh \ 53 && chmod +x /usr/local/share/docker-bind-mount.sh /usr/local/share/devcontainer-init.sh /usr/local/share/setup-docker-multiarch.sh \ 54 && chown ${USERNAME}:root /usr/local/share/docker-bind-mount.sh /usr/local/share/devcontainer-init.sh /usr/local/share/setup-docker-multiarch.sh \ 55 # 56 # Move the first run notice to the correct location for Codespaces. 57 && mkdir -p /usr/local/etc/vscode-dev-containers/ \ 58 # && mv -f /tmp/library-scripts/first-run-notice.txt /usr/local/etc/vscode-dev-containers/ \ 59 # 60 # Set permissions for the workspace folder 61 && mkdir -p /workspaces && chown ${USERNAME} /workspaces \ 62 # 63 # Clean up packages and the library-scripts folder. 64 && apt-get autoremove -y && apt-get clean -y && rm -rf /tmp/library-scripts/ 65 66 # [Optional] Uncomment the next line to use go get to install anything else you need 67 # RUN go get -x <your-dependency-or-tool> 68 69 # [Optional] Uncomment this section to install additional OS packages. 70 # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ 71 # && apt-get -y install --no-install-recommends <your-package-list-here> 72 73 # [Optional] Uncomment this line to install global node packages. 74 # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>& 75 76 # Mount for docker-in-docker 77 VOLUME [ "/var/lib/docker" ] 78 79 80 # Initialize Dapr devcontainer script 81 ENTRYPOINT [ "/usr/local/share/devcontainer-init.sh" ] 82 CMD [ "sleep", "infinity" ] 83 84 USER ${USERNAME}