From 706d19a13605c2e04a7bec7a9fd72b6a9db97855 Mon Sep 17 00:00:00 2001 From: Luis Guillen Civera Date: Wed, 22 Jul 2020 08:20:41 +0200 Subject: [PATCH] changed docker to use github token from arg, remove this in future --- Dockerfile.xlget | 15 ++++++++++++++- Dockerfile.xlistd | 15 ++++++++++++++- Makefile | 6 ++++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Dockerfile.xlget b/Dockerfile.xlget index 17eb694..b5cea26 100644 --- a/Dockerfile.xlget +++ b/Dockerfile.xlget @@ -1,10 +1,23 @@ -FROM golang:1.13-alpine as build-env +FROM golang:1.14-alpine as build-env + +# Arguments for build ARG arch=amd64 +# Set github user and token for private repositories +ARG github_user +ENV github_user=$github_user +ARG github_token +ENV github_token=$github_token # Install git and certificates RUN apk update && apk add --no-cache git make ca-certificates && update-ca-certificates WORKDIR /app + +## config git +RUN if [ ! -z "$github_user" ]; then git config --global \ + url."https://${github_user}:${github_token}@github.com/".insteadOf \ + "https://github.com/"; fi + ## dependences COPY go.mod . COPY go.sum . diff --git a/Dockerfile.xlistd b/Dockerfile.xlistd index 523ff58..1b56fb9 100644 --- a/Dockerfile.xlistd +++ b/Dockerfile.xlistd @@ -1,5 +1,12 @@ -FROM golang:1.13-alpine as build-env +FROM golang:1.14-alpine as build-env + +# Arguments for build ARG arch=amd64 +# Set github user and token for private repositories +ARG github_user +ENV github_user=$github_user +ARG github_token +ENV github_token=$github_token # Install git and certificates RUN apk update && apk add --no-cache git make ca-certificates && update-ca-certificates @@ -8,6 +15,12 @@ RUN apk update && apk add --no-cache git make ca-certificates && update-ca-certi RUN adduser -D -g 'luids' luxlist WORKDIR /app + +## config git +RUN if [ ! -z "$github_user" ]; then git config --global \ + url."https://${github_user}:${github_token}@github.com/".insteadOf \ + "https://github.com/"; fi + ## dependences COPY go.mod . COPY go.sum . diff --git a/Makefile b/Makefile index d15de07..50a2ed5 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,10 @@ clean: docker: @echo "$(WHALE) $@" - docker build -t xlistd -f Dockerfile.xlistd . - docker build -t xlget -f Dockerfile.xlget . + docker build -t xlistd -f Dockerfile.xlistd \ + --build-arg github_user=${github_user} --build-arg github_token=${github_token} . + docker build -t xlget -f Dockerfile.xlget \ + --build-arg github_user=${github_user} --build-arg github_token=${github_token} . ## Targets for Makefile.release .PHONY: release