-
Notifications
You must be signed in to change notification settings - Fork 144
/
Dockerfile
44 lines (31 loc) · 889 Bytes
/
Dockerfile
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
ARG GO_VERSION=1.22.2-bookworm
ARG GOIMPORTS_VERSION=0.20.0
ARG DELVE_VERSION=1.22.1
## Base image
FROM golang:${GO_VERSION} AS base
WORKDIR /go/src/app
ENV CGO_ENABLED=0
## Development image
FROM base AS development
ARG GOIMPORTS_VERSION
ARG DELVE_VERSION
RUN apt update \
&& apt install -y \
curl \
git \
jq \
python3 \
python3-pip \
zsh \
&& apt clean \
&& pip install --break-system-packages \
pyyaml \
&& go install golang.org/x/tools/cmd/goimports@v${GOIMPORTS_VERSION} \
&& go install github.com/go-delve/delve/cmd/dlv@v${DELVE_VERSION}
ARG USER_ID=1000
ENV USER_NAME=default
RUN useradd --user-group --create-home --uid ${USER_ID} ${USER_NAME} \
&& chown -R ${USER_NAME}: /go
USER ${USER_NAME}
ENV PROMPT="%B%F{cyan}%n%f@%m:%F{yellow}%~%f %F{%(?.green.red[%?] )}>%f %b"
RUN touch /home/${USER_NAME}/.zshrc