49: Use a Personal Access Token to access private modules. #4

Merged
roysc merged 6 commits from telackey/49b into wip 2023-07-07 04:36:32 +00:00

View File

@ -5,21 +5,18 @@ RUN apk add --no-cache gcc musl-dev binutils-gold linux-headers git
# Configure creds for gitea # Configure creds for gitea
ARG GITEA_TOKEN ARG GITEA_TOKEN
RUN echo $GITEA_TOKEN > ~/.token
RUN git config --global credential.username _ # ignored, but prevents prompt
RUN git config --global credential.helper \
'!f() { test "$1" = get && echo "password=$(cat $HOME/.token)"; }; f'
WORKDIR /plugeth-statediff/
# Get and cache deps # Get and cache deps
WORKDIR /plugeth-statediff/
COPY go.mod . COPY go.mod .
COPY go.sum . COPY go.sum .
RUN go mod download RUN if [ -n "$GITEA_TOKEN" ]; then git config --global url."https://$GITEA_TOKEN:@git.vdb.to/".insteadOf "https://git.vdb.to/"; fi && \
go mod download && \
rm -f ~/.gitconfig
ADD . . ADD . .
RUN go build --tags linkgeth --buildmode=plugin --trimpath -o statediff.so ./main RUN go build --tags linkgeth --buildmode=plugin --trimpath -o statediff.so ./main
FROM alpine:latest FROM alpine:3.18
COPY --from=builder /plugeth-statediff/statediff.so /usr/local/lib/ COPY --from=builder /plugeth-statediff/statediff.so /usr/local/lib/