-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (22 loc) · 876 Bytes
/
Dockerfile
File metadata and controls
31 lines (22 loc) · 876 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
FROM --platform=$BUILDPLATFORM golang as builder
ARG TARGETOS
ARG TARGETARCH
ARG VERSION
ARG BUILD_DATE
COPY . /src
WORKDIR /src
RUN env GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go mod download && \
export GIT_COMMIT=$(git rev-parse HEAD) && \
export GIT_DIRTY="" && \
env GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 \
go build -o docker-autoheal \
-ldflags "-X github.com/sqooba/go-common/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY} \
-X github.com/sqooba/go-common/version.BuildDate=${BUILD_DATE} \
-X github.com/sqooba/go-common/version.Version=${VERSION}" \
.
FROM --platform=$BUILDPLATFORM gcr.io/distroless/base
COPY --from=builder /src/docker-autoheal /docker-autoheal
# Because of access to docker.sock, it's easier to run it as root...
#USER nobody
ENTRYPOINT ["/docker-autoheal"]
EXPOSE 8080