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