-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
42 lines (35 loc) · 1002 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
34
35
36
37
38
39
40
41
42
#syntax=docker/dockerfile:1.10
FROM --platform=$BUILDPLATFORM golang:1.23.2-alpine AS flarectl
WORKDIR /app
ARG CF_REPO=cloudflare/cloudflare-go
ARG CF_VERSION=v0.107.0
RUN <<EOT
set -eux
apk add --no-cache git
git clone -q \
--config advice.detachedHead=false \
--branch "$CF_VERSION" \
--depth 1 \
"https://github.com/$CF_REPO.git" .
go mod download
EOT
# Set Golang build envs based on Docker platform string
ARG TARGETPLATFORM
RUN <<EOT
set -eux
case "$TARGETPLATFORM" in
'linux/amd64') export GOARCH=amd64 ;;
'linux/arm/v6') export GOARCH=arm GOARM=6 ;;
'linux/arm/v7') export GOARCH=arm GOARM=7 ;;
'linux/arm64') export GOARCH=arm64 ;;
*) echo "Unsupported target: $TARGETPLATFORM" && exit 1 ;;
esac
go build -ldflags='-w -s' -trimpath ./cmd/flarectl
EOT
FROM b3vis/borgmatic:1.8.14
WORKDIR /data
RUN apk add --no-cache jq
COPY --from=flarectl /app/flarectl /usr/local/bin
COPY rootfs/ /
ENTRYPOINT ["sh"]
CMD ["/entrypoint"]