Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit 4bae978

Browse files
author
1138-4EB
committed
use go modules outside of GOPATH, CGO_ENABLED=0 (#3)
1 parent 428006a commit 4bae978

File tree

2 files changed

+39
-21
lines changed

2 files changed

+39
-21
lines changed

Dockerfile

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,10 @@ RUN apk add -U --no-cache git && \
66

77
FROM golang:alpine
88

9-
WORKDIR /go/src/github.com/filebrowser/filebrowser
10-
119
COPY --from=base /go/bin /go/bin
10+
COPY get_deps.sh ./get_deps.sh
11+
12+
ENV CGO_ENABLED 0
1213

1314
RUN apk --no-cache -U upgrade && apk --no-cache add ca-certificates yarn git curl dos2unix && \
14-
go get github.com/GeertJohan/go.rice/rice && \
15-
curl -fsSL -o /go/bin/dep $( \
16-
curl -s https://api.github.com/repos/golang/dep/releases/latest \
17-
| grep "browser_download_url.*linux-amd64\"" \
18-
| cut -d : -f 2,3 \
19-
| tr -d \" \
20-
) && \
21-
chmod +x /go/bin/dep && \
22-
curl -sL https://git.io/goreleaser -o /go/bin/goreleaser && \
23-
chmod +x /go/bin/goreleaser && \
24-
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 && \
25-
chmod +x /go/bin/docker && \
26-
curl -fsSL $( \
27-
curl -s https://api.github.com/repos/docker/docker-credential-helpers/releases/latest \
28-
| grep "browser_download_url.*pass-.*-amd64" \
29-
| cut -d : -f 2,3 \
30-
| tr -d \" \
31-
) | tar xv -C /go/bin && \
32-
chmod + /go/bin/docker-credential-pass
15+
chmod +x get_deps.sh && ./get_deps.sh && rm get_deps.sh

get_deps.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/sh
2+
3+
#-- go.rice
4+
5+
go get github.com/GeertJohan/go.rice/rice
6+
7+
#-- goreleaser
8+
9+
curl -sL https://git.io/goreleaser -o /go/bin/goreleaser
10+
11+
chmod +x /go/bin/goreleaser
12+
13+
#-- docker
14+
15+
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
16+
17+
chmod +x /go/bin/docker
18+
19+
#-- docker-credential-pass
20+
21+
PASS_URL="$(curl -s https://api.github.com/repos/docker/docker-credential-helpers/releases/latest \
22+
| grep "browser_download_url.*pass-.*-amd64" \
23+
| cut -d : -f 2,3 \
24+
| tr -d \")"
25+
PASS_URL="$(echo $PASS_URL | cut -c2-)"
26+
27+
if [ "$(echo "$PASS_URL" | cut -c1-5)" != "https" ]; then
28+
PASS_URL="https://github.com/docker/docker-credential-helpers/releases/download/v0.6.0/docker-credential-pass-v0.6.0-amd64.tar.gz"
29+
fi
30+
31+
echo "PASS_URL: $PASS_URL"
32+
33+
curl -fsSL "$PASS_URL" | tar xv -C /go/bin
34+
35+
chmod + /go/bin/docker-credential-pass

0 commit comments

Comments
 (0)