Merge branch 'main' of ssh://git@code.brothertec.eu:1023/simono41/prometheus-jitsi-meet-exporter.git
This commit is contained in:
commit
62484b3681
1 changed files with 22 additions and 20 deletions
36
Dockerfile
36
Dockerfile
|
@ -1,28 +1,30 @@
|
||||||
FROM alpine:3.19.0 as builder
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
WORKDIR /go/src/github.com/systemli/prometheus-jitsi-meet-exporter
|
# Build the application from source
|
||||||
|
FROM golang:1.21.4 AS build-stage
|
||||||
|
|
||||||
ENV USER=appuser
|
WORKDIR /app
|
||||||
ENV UID=10001
|
|
||||||
|
|
||||||
RUN adduser \
|
COPY go.mod go.sum ./
|
||||||
--disabled-password \
|
RUN go mod download
|
||||||
--gecos "" \
|
|
||||||
--home "/nonexistent" \
|
|
||||||
--shell "/sbin/nologin" \
|
|
||||||
--no-create-home \
|
|
||||||
--uid "${UID}" \
|
|
||||||
"${USER}"
|
|
||||||
|
|
||||||
|
COPY *.go ./
|
||||||
|
|
||||||
FROM scratch
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /prometheus-jitsi-meet-exporter
|
||||||
|
|
||||||
COPY --from=builder /etc/passwd /etc/passwd
|
# Run the tests in the container
|
||||||
COPY --from=builder /etc/group /etc/group
|
FROM build-stage AS run-test-stage
|
||||||
COPY prometheus-jitsi-meet-exporter /prometheus-jitsi-meet-exporter
|
RUN go test -v ./...
|
||||||
|
|
||||||
USER appuser:appuser
|
# Deploy the application binary into a lean image
|
||||||
|
FROM gcr.io/distroless/base-debian11 AS build-release-stage
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
COPY --from=build-stage /prometheus-jitsi-meet-exporter /prometheus-jitsi-meet-exporter
|
||||||
|
|
||||||
EXPOSE 9888
|
EXPOSE 9888
|
||||||
|
|
||||||
|
USER nonroot:nonroot
|
||||||
|
|
||||||
ENTRYPOINT ["/prometheus-jitsi-meet-exporter"]
|
ENTRYPOINT ["/prometheus-jitsi-meet-exporter"]
|
||||||
|
|
Loading…
Reference in a new issue