-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (26 loc) · 728 Bytes
/
Dockerfile
File metadata and controls
35 lines (26 loc) · 728 Bytes
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
# Variables
ARG ALPINE_VERSION=3.22
ARG GOLANG_VERSION=1.26.1
ARG USERID=65532
FROM alpine:${ALPINE_VERSION} AS builder
#
# Builder-Stage ++++++++++++++++++++++++++++++++++++++++
#
FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o waitfor
#
# Final-Stage ++++++++++++++++++++++++++++++++++++++++
#
FROM alpine:${ALPINE_VERSION}
ARG USERID
# Create a non-root user "app" to run the application
RUN addgroup -g ${USERID} app && adduser -u ${USERID} -G app -S app
# Copy compiled bin into final image
COPY --from=builder /app/waitfor /usr/local/bin/waitfor
# Set to nonroot user
USER ${USERID}:${USERID}
ENTRYPOINT ["waitfor"]