-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.debian
126 lines (100 loc) · 4.51 KB
/
Dockerfile.debian
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
ARG DEBIAN_VERSION=bookworm
ARG DOCKER_VERSION=27.2.1
ARG DOCKER_COMPOSE_VERSION=v2.29.3
FROM docker:${DOCKER_VERSION} AS docker
####################################################################################
## go-devcontainer-ci-debian stage ##
## contains minimal setup to run on a CI platform ##
####################################################################################
FROM bitnami/minideb:${DEBIAN_VERSION} AS go-devcontainer-ci-debian
RUN install_packages \
ca-certificates \
wget curl \
bash zsh \
git
# Go
ARG GO_VERSION=1.23.1
RUN wget -nv -O- https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xz
COPY scripts/cache-command.sh /usr/local/bin/cache
COPY scripts/install-tool.sh /usr/local/bin/up
RUN groupadd -g 1000 -r vscode \
&& useradd -r -u 1000 -g vscode -s /bin/zsh vscode \
&& cp -r /root/. /home/vscode \
&& chown -R vscode:vscode /home/vscode
USER vscode
ENV GOPATH="/home/vscode/go"
ENV GOBIN="${GOPATH}/bin"
ENV PATH="${PATH}:/usr/local/go/bin:${GOPATH}/bin" \
CGO_ENABLED=0 \
GO111MODULE=on
RUN up golangci-lint 1.61.0 \
&& up venom 1.2.0 \
&& up neon 1.10.1 \
&& up goreleaser 2.3.1 \
&& up svu 2.2.0 \
&& go clean -cache -testcache
####################################################################################
## go-devcontainer-slim-debian stage ##
## contains a slim setup for development usage ##
####################################################################################
FROM go-devcontainer-ci-debian AS go-devcontainer-slim-debian
USER root
RUN install_packages \
locales tzdata \
sudo \
figlet \
jq \
# Generate default locale
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen \
# Promote user as sudoer
&& echo vscode ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/vscode \
&& chmod 0440 /etc/sudoers.d/vscode
USER vscode
# Default values, override with a dotfile repository (https://code.visualstudio.com/docs/remote/containers#_personalizing-with-dotfile-repositories)
ENV TZ= \
LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
LANGUAGE=en_US:en \
TERM=xterm
# Zsh Theme
RUN wget -O- -nv https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh \
&& git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k \
&& rm -rf ~/.oh-my-zsh/custom/themes/powerlevel10k/.git* \
&& mkdir -p ~/.cache/gitstatus \
&& wget -O- -nv https://github.com/romkatv/gitstatus/releases/download/v1.5.4/gitstatusd-linux-x86_64.tar.gz | tar -xz -C ~/.cache/gitstatus gitstatusd-linux-x86_64
# Zsh Theme configuration
COPY .zshrc /home/vscode/.zshrc
COPY .p10k.zsh /home/vscode/.p10k.zsh
# Docker CLI
COPY --chown=root:root --from=docker /usr/local/bin/docker /usr/bin/docker
RUN sudo chmod +x /usr/bin/docker
RUN sudo mkdir -p /usr/local/lib/docker/cli-plugins
RUN sudo curl -SL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose
COPY welcome.sh /home/vscode/welcome.sh
COPY scripts/list-docker-tags.sh /usr/local/bin/dtags
COPY scripts/get-latest-version-docker.sh /usr/local/bin/dlast
COPY scripts/get-latest-version-github.sh /usr/local/bin/glast
COPY scripts/update-go-debian.sh /usr/local/bin/up-go
COPY scripts/update-docker.sh /usr/local/bin/up-docker
COPY scripts/update-git-debian.sh /usr/local/bin/up-git
ENTRYPOINT [ "/bin/zsh" ]
####################################################################################
## go-devcontainer-full-debian stage ##
## contains a full setup for development usage ##
####################################################################################
FROM go-devcontainer-slim-debian AS go-devcontainer-full-debian
# These tools are usually installed by VSCode golang extension
RUN up gopls 0.16.2 \
&& up delve 1.23.0 \
&& up gopkgs 2.1.2 \
&& up go-outline \
&& up goplay 1.0.0 \
&& up gomodifytags 1.17.0 \
&& up impl \
&& up gotests 1.6.0 \
&& go clean -cache -testcache
# Optionnal tools
RUN up changie 1.21.0 \
&& up cli 2.56.0 \
&& go clean -cache -testcache