-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile
32 lines (21 loc) · 844 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
FROM golang:1.22@sha256:a66eda637829ce891e9cf61ff1ee0edf544e1f6c5b0e666c7310dce231a66f28 as builder
WORKDIR /build
RUN go install github.com/swaggo/swag/cmd/swag@v1.16.2
ADD go.mod .
ADD go.mod .
RUN go mod download
ADD . .
RUN swag init
# CGO_ENABLED=0 ist ab golang:1.20 notwendig, da sonst das Binary nicht auf Alpine laufen würde
# -> libresolv.so.2: no such file or directory
RUN CGO_ENABLED=0 go build -o text2qrcode-bin .
# ---
FROM alpine:latest@sha256:b89d9c93e9ed3597455c90a0b88a8bbb5cb7188438f70953fede212a0c4394e0
# Kann deaktiviert werden, da das Binary mit CGO_ENABLED=0 kompiliert wurde
#RUN apk add libc6-compat tzdata
WORKDIR /app
COPY --from=builder /build/text2qrcode-bin /app/
ENV GIN_MODE=release
EXPOSE 8080/tcp
HEALTHCHECK CMD curl --fail http://localhost:8080/healthcheck || exit 1
CMD ["./text2qrcode-bin"]