build with private module

This commit is contained in:
Chris Ainsworth-Patrick
2023-08-17 09:01:28 +01:00
parent fc9040027d
commit 711ff81119
5 changed files with 557 additions and 87 deletions

View File

@@ -33,6 +33,13 @@ COPY main.go ./
COPY docker/ ./docker/
COPY babashka/ ./babashka/
ENV GOPRIVATE=github.com/docker
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
RUN --mount=type=secret,id=gitghatoken \
(test -f /run/secrets/gitghatoken && \
git config --global url."https://x-access-token:$(cat /run/secrets/gitghatoken)@github.com/docker".insteadOf "https://github.com/docker" || \
git config --global url."git@github.com:docker/".insteadOf "https://github.com/docker/")
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o babashka-pod-docker
FROM alpine:3.17