-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
30 lines (25 loc) · 903 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
# Build the Go Binary.
FROM golang:1.19 as build_down_monitor
ENV CGO_ENABLED 0
ARG BUILD_REF
# Copy the source code into the container.
COPY . /service
# Build the app binary.
WORKDIR /service/cmd/app
RUN go build -ldflags "-X main.build=${BUILD_REF}"
# Run the Go Binary in Alpine.
FROM alpine:3.16
ARG BUILD_DATE
ARG BUILD_REF
RUN addgroup -g 1000 -S down_monitor && \
adduser -u 1000 -h /service -G down_monitor -S down_monitor
COPY --from=build_down_monitor --chown=down_monitor:down_monitor /service/cmd/app /service
WORKDIR /service
USER down_monitor
CMD ["./app"]
LABEL org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.title="down_monitor" \
org.opencontainers.image.authors="Saeed Jalali" \
org.opencontainers.image.source="" \
org.opencontainers.image.revision="${BUILD_REF}" \
org.opencontainers.image.vendor="Saeed Jalali"