19 lines
691 B
Docker
19 lines
691 B
Docker
FROM golang:1.24-alpine AS build
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
ARG VERSION=dev
|
|
ARG TARGETOS=linux
|
|
ARG TARGETARCH=amd64
|
|
ARG TARGETVARIANT=
|
|
RUN set -eux; GOARM=""; if [ "$TARGETARCH" = "arm" ] && [ "$TARGETVARIANT" = "v7" ]; then GOARM=7; fi; CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" GOARM="$GOARM" go build -trimpath -ldflags "-s -w -X main.version=${VERSION}" -o /out/chfs-ng ./cmd/chfs
|
|
|
|
FROM scratch
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
COPY --from=build /out/chfs-ng /usr/local/bin/chfs-ng
|
|
VOLUME ["/data"]
|
|
EXPOSE 80
|
|
ENTRYPOINT ["/usr/local/bin/chfs-ng"]
|
|
CMD ["-path", "/data", "-port", "80"]
|