-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.static
40 lines (30 loc) · 1.26 KB
/
Dockerfile.static
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
FROM --platform=${BUILDPLATFORM} ghcr.io/darkness4/fc2-live-dl-go:latest-static-base AS builder
WORKDIR /work
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG TARGETARCH
ARG VERSION=dev
RUN if [ "${TARGETARCH}" = "amd64" ]; then \
export GOARCH="amd64"; \
elif [ "${TARGETARCH}" = "arm64" ]; then \
export GOARCH="arm64"; \
export CC="aarch64-gentoo-linux-musl-gcc"; \
export CXX="aarch64-gentoo-linux-musl-g++"; \
export PKG_CONFIG="aarch64-gentoo-linux-musl-pkg-config"; \
elif [ "${TARGETARCH}" = "riscv64" ]; then \
export GOARCH="riscv64"; \
export CC="riscv64-gentoo-linux-musl-gcc"; \
export CXX="riscv64-gentoo-linux-musl-g++"; \
export PKG_CONFIG="riscv64-gentoo-linux-musl-pkg-config"; \
fi; \
CGO_ENABLED=1 GOARCH=${TARGETARCH} make bin/fc2-live-dl-go-static VERSION=${VERSION}
# Helper container to copy binaries outside the container using podman/buildx export. Unused in production.
FROM scratch AS export
ARG TARGETARCH
COPY --from=builder /work/bin/fc2-live-dl-go-static /fc2-live-dl-go-linux-${TARGETARCH}
# Running container
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /work/bin/fc2-live-dl-go-static /fc2-live-dl-go
ENTRYPOINT [ "/fc2-live-dl-go" ]