-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (31 loc) · 1.16 KB
/
Dockerfile
File metadata and controls
48 lines (31 loc) · 1.16 KB
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
FROM golang:1.26-alpine AS build
ENV CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
RUN openssh-client ca-certificates && update-ca-certificates 2>/dev/null || true
ENV HOME=/home/golang
WORKDIR /app
RUN adduser -h $HOME -D -u 1000 -G root golang && \
chown golang:root /app && \
chmod g=u /app $HOME
USER golang:root
COPY --chown=golang:root go.mod go.sum ./
RUN go mod download
COPY --chown=golang:root cmd ./cmd
COPY --chown=golang:root internal ./internal
RUN go build -v -o joy-generator ./cmd/server
FROM alpine:3.23 AS prod
COPY --from=build /etc/passwd /etc/group /etc/
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build --chown=golang:root /app/joy-generator /app/
RUN \
apk add perl-utils && \
wget https://get.helm.sh/helm-v3.18.5-linux-amd64.tar.gz -q && \
echo "9879bf9c471cdecbbee5ee17cf1de1849b0ffd12871ea01f17ede6861d7134f5 helm-v3.18.5-linux-amd64.tar.gz" | shasum -a256 --check - && \
tar -xzf helm-v3.18.5-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/local/bin
RUN mkdir -p /home/golang && chown -R golang:root /home/golang
USER golang:root
EXPOSE 8080
WORKDIR /app
ENTRYPOINT ["./joy-generator"]