From b54cd38d0be564dad2dce2e25c82dffed7bc4428 Mon Sep 17 00:00:00 2001 From: pat-s Date: Sun, 19 May 2024 16:18:11 +0000 Subject: [PATCH] Fix Dockerfile binary location (#337) I know get the following ``` docker run --rm pages-server:test 12:40PM ERR A fatal error occurred error="could not create new gitea client: Get \"/api/v1/version\": unsupported protocol scheme \"\"" ``` which I am not sure is OK as doing the same with v5.1 results in ``` docker run --platform linux/amd64 --rm -it codeberg.org/codeberg/pages-server:v5.1 ACME client has wrong config: you must set $ACME_ACCEPT_TERMS and $DNS_PROVIDER, unless $ACME_API is set to https://acme.mock.directory ``` The error is the same though what I get when building of 8cba7f9c8ad591b2c2ebef8f0978343ab3a14ead (just before merging the multi-arch PR). Not sure if this ERR is expected but it should be unrelated to the multiarch approach. Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/337 Reviewed-by: crapStone Co-authored-by: pat-s Co-committed-by: pat-s --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9c05cda..6106317 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,13 +16,14 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg \ GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=1 \ xgo -x -v --targets=${TARGETOS}/${TARGETARCH} -tags='sqlite sqlite_unlock_notify netgo' -ldflags='-s -w -extldflags "-static" -linkmode external' -out pages . +RUN mv -vf /build/pages-* /go/src/codeberg.org/codeberg/pages/pages # Use a scratch image as the base image for the final container, # which will contain only the built binary and the CA certificates FROM scratch # Copy the built binary and the CA certificates from the build container to the final container -COPY --from=build /go/src/codeberg.org/codeberg/pages/ /pages +COPY --from=build /go/src/codeberg.org/codeberg/pages/pages /pages COPY --from=build \ /etc/ssl/certs/ca-certificates.crt \ /etc/ssl/certs/ca-certificates.crt