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
|
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 GIT_VDBTO_TOKEN
|
||||||
RUN echo $GITEA_TOKEN > ~/.token
|
|
||||||
RUN git config --global credential.username _ # ignored, but prevents prompt
|
ENV GOPROXY="https://goproxy.cn,direct"
|
||||||
RUN git config --global credential.helper \
|
|
||||||
'!f() { test "$1" = get && echo "password=$(cat $HOME/.token)"; }; f'
|
|
||||||
|
|
||||||
# Get dependencies - will also be cached if we won't change go.mod/go.sum
|
# Get dependencies - will also be cached if we won't change go.mod/go.sum
|
||||||
COPY go.mod /go-ethereum/
|
WORKDIR /go-ethereum/
|
||||||
COPY go.sum /go-ethereum/
|
COPY go.mod go.sum .
|
||||||
RUN cd /go-ethereum && go mod download
|
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
|
COPY . .
|
||||||
RUN cd /go-ethereum/wrapmain && go build --trimpath -o /go-ethereum/build/bin/geth .
|
RUN cd wrapmain && go build --trimpath -o /go-ethereum/build/bin/geth .
|
||||||
|
|
||||||
# Pull Geth into a second stage deploy alpine container
|
# Pull Geth into a second stage deploy alpine container
|
||||||
FROM alpine:latest
|
FROM alpine:3.18
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN apk add --no-cache ca-certificates
|
||||||
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
|
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
|
||||||
|
Loading…
Reference in New Issue
Block a user