improve git token config
This commit is contained in:
parent
35cf277d70
commit
b599af5f00
23
Dockerfile
23
Dockerfile
@ -9,22 +9,23 @@ FROM golang:1.20-alpine as builder
|
||||
RUN apk add --no-cache gcc musl-dev binutils-gold linux-headers git
|
||||
|
||||
# Configure creds for gitea
|
||||
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'
|
||||
ARG GIT_VDBTO_TOKEN
|
||||
|
||||
ENV GOPROXY="https://goproxy.cn,direct"
|
||||
|
||||
# Get dependencies - will also be cached if we won't change go.mod/go.sum
|
||||
COPY go.mod /go-ethereum/
|
||||
COPY go.sum /go-ethereum/
|
||||
RUN cd /go-ethereum && go mod download
|
||||
WORKDIR /go-ethereum/
|
||||
COPY go.mod go.sum .
|
||||
RUN [ -n "$GIT_VDBTO_TOKEN" ] && \
|
||||
git config --global url."https://$GIT_VDBTO_TOKEN@git.vdb.to/".insteadOf "https://git.vdb.to/" && \
|
||||
go mod download && \
|
||||
rm -f ~/.gitconfig
|
||||
|
||||
ADD . /go-ethereum
|
||||
RUN cd /go-ethereum/wrapmain && go build --trimpath -o /go-ethereum/build/bin/geth .
|
||||
COPY . .
|
||||
RUN cd wrapmain && go build --trimpath -o /go-ethereum/build/bin/geth .
|
||||
|
||||
# Pull Geth into a second stage deploy alpine container
|
||||
FROM alpine:latest
|
||||
FROM alpine:3.18
|
||||
|
||||
RUN apk add --no-cache ca-certificates
|
||||
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
|
||||
|
Loading…
Reference in New Issue
Block a user