34 lines
No EOL
562 B
Docker
34 lines
No EOL
562 B
Docker
FROM golang:1.25.1-alpine3.22 AS builder
|
|
|
|
RUN apk add --no-cache \
|
|
bash \
|
|
curl \
|
|
git \
|
|
ca-certificates
|
|
|
|
|
|
RUN apk add --no-cache tzdata
|
|
|
|
WORKDIR /app
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o main "./cmd"
|
|
|
|
|
|
FROM alpine:3.22
|
|
|
|
RUN apk add --no-cache \
|
|
bash \
|
|
curl \
|
|
ca-certificates \
|
|
tzdata
|
|
|
|
COPY --from=builder /app/main /usr/local/bin/app
|
|
|
|
|
|
RUN chmod +x /usr/local/bin/app
|
|
RUN adduser -D -s /bin/bash appuser
|
|
USER appuser
|
|
|
|
ENTRYPOINT ["app"] |