-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.alpine
123 lines (98 loc) · 4.24 KB
/
Dockerfile.alpine
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
ARG ALPINE_VERSION=3.20
ARG GO_VERSION=1.23.1
ARG DOCKER_VERSION=27.2.1
FROM docker:${DOCKER_VERSION}-alpine${ALPINE_VERSION} AS docker
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS go
####################################################################################
## go-devcontainer-ci-alpine stage ##
## contains minimal setup to run on a CI platform ##
####################################################################################
FROM alpine:${ALPINE_VERSION} AS go-devcontainer-ci-alpine
# Required packages for CI
RUN apk add -q --update --progress --no-cache \
ca-certificates \
wget curl \
bash zsh \
git
# Go
COPY --from=go /usr/local/go /usr/local/go
COPY scripts/cache-command.sh /usr/local/bin/cache
COPY scripts/install-tool.sh /usr/local/bin/up
RUN addgroup -g 1000 -S vscode \
&& adduser -S -s /bin/zsh -G vscode -D -u 1000 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-alpine stage ##
## contains a slim setup for development usage ##
####################################################################################
FROM go-devcontainer-ci-alpine AS go-devcontainer-slim-alpine
USER root
# Timezones
RUN apk add -q --update --progress --no-cache \
tzdata \
su-exec sudo \
git-perl \
figlet \
jq \
# 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 --from=docker /usr/local/bin/docker /usr/bin/docker
RUN sudo apk add -q --update --progress --no-cache 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.sh /usr/local/bin/up-go
COPY scripts/update-docker.sh /usr/local/bin/up-docker
COPY scripts/update-git.sh /usr/local/bin/up-git
ENTRYPOINT [ "/bin/zsh" ]
####################################################################################
## go-devcontainer-full-alpine stage ##
## contains a full setup for development usage ##
####################################################################################
FROM go-devcontainer-slim-alpine AS go-devcontainer-full-alpine
# 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