-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
33 lines (22 loc) · 856 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
31
32
33
# syntax = docker/dockerfile:experimental
# Builder image to build the app
FROM --platform=$BUILDPLATFORM golang:1.22.1 as builder
LABEL maintainer=dadrus@gmx.de
ARG TARGETARCH
ARG VERSION="unknown"
ENV USER=test
ENV UID=10001
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN useradd -l -s "/sbin/nologin" -M -U -r -u ${UID} ${USER}
WORKDIR /app
COPY . .
RUN go mod download && GOOS=linux GOARCH=$TARGETARCH go build -a -trimpath -ldflags="-buildid= -w -s -X github.com/dadrus/github-integrations/version.Version=${VERSION}"
# The actual image of the app
FROM scratch
LABEL maintainer=dadrus@gmx.de
WORKDIR /opt/github-integrations
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder /app/github-integrations .
USER ${USER}:${USER}
ENTRYPOINT ["/opt/github-integrations/github-integrations"]