-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
46 lines (28 loc) · 1 KB
/
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
45
46
# syntax=docker/dockerfile:1.4
FROM golang:1.20-alpine AS builder
WORKDIR /workspace
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Build the binary
RUN CGO_ENABLED=0 go build -o . ./...
# scratch image
FROM scratch AS scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /workspace/aws-rds-authenticator .
ENTRYPOINT [ "./aws-rds-authenticator" ]
# debian image
FROM debian:bullseye-slim AS bullseye
RUN apt-get update && apt-get install -y ca-certificates
RUN addgroup --system app --gid 888 && \
adduser --system --no-create-home --uid 888 --ingroup app app
COPY --from=builder --chown=app:app /workspace/aws-rds-authenticator .
USER app
ENTRYPOINT [ "./aws-rds-authenticator" ]
# alpine image
FROM alpine:3.17 AS alpine
RUN addgroup --system app --gid 888 && \
adduser --system --no-create-home --uid 888 --ingroup app app
COPY --from=builder --chown=app:app /workspace/aws-rds-authenticator .
USER app
ENTRYPOINT [ "./aws-rds-authenticator" ]