From 8beec344e428b3a1214a36b052f571b964bdfb38 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Mon, 20 Aug 2018 17:10:17 +0100 Subject: [PATCH 1/6] replace dep with go mod --- .travis.yml | 6 +++--- Dockerfile | 9 ++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7d5cecb..f0664f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,11 @@ addons: packages: - docker-ce - pass -script: docker build -t filebrowser/dev . +script: docker build -t filebrowser/dev:mod . deploy: provider: script skip_cleanup: true - script: ./docker_login.sh && docker push filebrowser/dev && docker logout + script: ./docker_login.sh && docker push filebrowser/dev:mod && docker logout on: repo: filebrowser/docker-dev - branch: master + branch: mod diff --git a/Dockerfile b/Dockerfile index b8a3f46..0e2a7f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,13 +12,6 @@ COPY --from=base /go/bin /go/bin RUN apk --no-cache -U upgrade && apk --no-cache add ca-certificates yarn git curl dos2unix && \ go get github.com/GeertJohan/go.rice/rice && \ - curl -fsSL -o /go/bin/dep $( \ - curl -s https://api.github.com/repos/golang/dep/releases/latest \ - | grep "browser_download_url.*linux-amd64\"" \ - | cut -d : -f 2,3 \ - | tr -d \" \ - ) && \ - chmod +x /go/bin/dep && \ curl -sL https://git.io/goreleaser -o /go/bin/goreleaser && \ chmod +x /go/bin/goreleaser && \ curl -fsSL https://download.docker.com/linux/static/edge/x86_64/docker-18.05.0-ce.tgz | tar xvz --strip-components=1 docker/docker -C /go/bin && \ @@ -30,3 +23,5 @@ RUN apk --no-cache -U upgrade && apk --no-cache add ca-certificates yarn git cur | tr -d \" \ ) | tar xv -C /go/bin && \ chmod + /go/bin/docker-credential-pass + +ENV GO111MODULE on From fdd99cb6e4ec671d4d1be9586a09cf83fbe74a7f Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Tue, 25 Dec 2018 03:27:15 +0100 Subject: [PATCH 2/6] move deps install to separate script, unset GO111MODULE --- Dockerfile | 16 ++-------------- get_deps.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 get_deps.sh diff --git a/Dockerfile b/Dockerfile index 0e2a7f5..831b897 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,19 +9,7 @@ FROM golang:alpine WORKDIR /go/src/github.com/filebrowser/filebrowser COPY --from=base /go/bin /go/bin +COPY get_deps.sh ./get_deps.sh RUN apk --no-cache -U upgrade && apk --no-cache add ca-certificates yarn git curl dos2unix && \ - go get github.com/GeertJohan/go.rice/rice && \ - curl -sL https://git.io/goreleaser -o /go/bin/goreleaser && \ - chmod +x /go/bin/goreleaser && \ - curl -fsSL https://download.docker.com/linux/static/edge/x86_64/docker-18.05.0-ce.tgz | tar xvz --strip-components=1 docker/docker -C /go/bin && \ - chmod +x /go/bin/docker && \ - curl -fsSL $( \ - curl -s https://api.github.com/repos/docker/docker-credential-helpers/releases/latest \ - | grep "browser_download_url.*pass-.*-amd64" \ - | cut -d : -f 2,3 \ - | tr -d \" \ - ) | tar xv -C /go/bin && \ - chmod + /go/bin/docker-credential-pass - -ENV GO111MODULE on + chmod +x get_deps.sh && ./get_deps.sh && rm get_deps.sh diff --git a/get_deps.sh b/get_deps.sh new file mode 100644 index 0000000..49f8e10 --- /dev/null +++ b/get_deps.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +#-- go.rice + +go get github.com/GeertJohan/go.rice/rice + +#-- goreleaser + +curl -sL https://git.io/goreleaser -o /go/bin/goreleaser + +chmod +x /go/bin/goreleaser + +#-- docker + +curl -fsSL https://download.docker.com/linux/static/edge/x86_64/docker-18.05.0-ce.tgz | tar xvz --strip-components=1 docker/docker -C /go/bin + +chmod +x /go/bin/docker + +#-- docker-credential-pass + +curl -fsSL $( \ + curl -s https://api.github.com/repos/docker/docker-credential-helpers/releases/latest \ + | grep "browser_download_url.*pass-.*-amd64" \ + | cut -d : -f 2,3 \ + | tr -d \" \ +) | tar xv -C /go/bin + +chmod + /go/bin/docker-credential-pass From 0cf098b022ae8b680e60379c6e5f851a4e96d896 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Tue, 25 Dec 2018 03:30:37 +0100 Subject: [PATCH 3/6] unset WORKDIR --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 831b897..8e4c10c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,6 @@ RUN apk add -U --no-cache git && \ FROM golang:alpine -WORKDIR /go/src/github.com/filebrowser/filebrowser - COPY --from=base /go/bin /go/bin COPY get_deps.sh ./get_deps.sh From 18cf4a7854ff5efbc1e8ce67cfb87af94c3be203 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Tue, 25 Dec 2018 04:19:53 +0100 Subject: [PATCH 4/6] set CGO_ENABLED=0 --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 8e4c10c..5c843d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,5 +9,7 @@ FROM golang:alpine COPY --from=base /go/bin /go/bin COPY get_deps.sh ./get_deps.sh +ENV CGO_ENABLED 0 + RUN apk --no-cache -U upgrade && apk --no-cache add ca-certificates yarn git curl dos2unix && \ chmod +x get_deps.sh && ./get_deps.sh && rm get_deps.sh From 8bcb5c942ed757c44826887add9e394716fb96de Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Tue, 25 Dec 2018 05:07:18 +0100 Subject: [PATCH 5/6] add workaround for failing GitHub API calls --- get_deps.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/get_deps.sh b/get_deps.sh index 49f8e10..a258d13 100644 --- a/get_deps.sh +++ b/get_deps.sh @@ -18,11 +18,15 @@ chmod +x /go/bin/docker #-- docker-credential-pass -curl -fsSL $( \ - curl -s https://api.github.com/repos/docker/docker-credential-helpers/releases/latest \ - | grep "browser_download_url.*pass-.*-amd64" \ +PASS_URL="$(curl -s https://api.github.com/repos/docker/docker-credential-helpers/releases/latest \ + | grep "browser_download_url.*pass-.*-amd64" \ | cut -d : -f 2,3 \ - | tr -d \" \ -) | tar xv -C /go/bin + | tr -d \")" + +if [ "$(echo "$PASS_URL" | cut -c2-6)" != "https" ]; then + PASS_URL="https://github.com/docker/docker-credential-helpers/releases/download/v0.6.0/docker-credential-pass-v0.6.0-amd64.tar.gz" +fi + +curl -fsSL "$PASS_URL" | tar xv -C /go/bin chmod + /go/bin/docker-credential-pass From 5acb59fe2a01caa70b7bff35969e8b2f1edea280 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Tue, 25 Dec 2018 05:15:02 +0100 Subject: [PATCH 6/6] fix .travis.yml for master --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f0664f8..7d5cecb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,11 @@ addons: packages: - docker-ce - pass -script: docker build -t filebrowser/dev:mod . +script: docker build -t filebrowser/dev . deploy: provider: script skip_cleanup: true - script: ./docker_login.sh && docker push filebrowser/dev:mod && docker logout + script: ./docker_login.sh && docker push filebrowser/dev && docker logout on: repo: filebrowser/docker-dev - branch: mod + branch: master