-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile
28 lines (20 loc) · 807 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
# syntax=docker/dockerfile:1
# Go version is also in .github/workflows/CI&CD.yml.
FROM golang:1.23.1-alpine3.20 AS builder
SHELL ["/bin/ash","-e","-o","pipefail","-x","-c"]
LABEL org.opencontainers.image.source="https://github.com/powerman/dockerize"
# hadolint ignore=DL3019
RUN apk update; \
apk add openssl=~3 git=~2; \
apk add upx=~4 || :; \
rm -f /var/cache/apk/*
COPY . /src
WORKDIR /src
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg/mod \
CGO_ENABLED=0 go install -ldflags "-s -w -X 'main.ver=$(git describe --match='v*' --exact-match)'" && \
! which upx >/dev/null || upx /go/bin/dockerize && \
dockerize --version
FROM alpine:3.20.3
COPY --from=builder /go/bin/dockerize /usr/local/bin
ENTRYPOINT ["dockerize"]
CMD ["--help"]