forked from goproxy/goproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (32 loc) · 1010 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM golang:1.22-alpine3.20 AS build
ARG USE_GORELEASER_ARTIFACTS=0
WORKDIR /usr/local/src/goproxy
COPY . .
RUN set -eux; \
if [ $USE_GORELEASER_ARTIFACTS -eq 1 ]; then \
GOARCH=$(go env GOARCH); \
BIN_DIR=dist/goproxy_linux_$GOARCH; \
[ $GOARCH == "amd64" ] && BIN_DIR=${BIN_DIR}_v1; \
[ $GOARCH == "arm" ] && BIN_DIR=${BIN_DIR}_$(go env GOARM | cut -d , -f 1); \
cp -r $BIN_DIR bin; \
else \
apk add --no-cache git; \
go mod download; \
CGO_ENABLED=0 go build \
-trimpath \
-ldflags "-s -w -X github.com/goproxy/goproxy/cmd/goproxy/internal.Version=$(git describe --dirty --tags --always)" \
-o bin/ \
./cmd/goproxy; \
fi
FROM alpine:3.20
COPY --from=build /usr/local/src/goproxy/bin/ /usr/local/bin/
RUN apk add --no-cache go git git-lfs openssh gpg subversion fossil mercurial breezy
RUN git lfs install --system
USER nobody
WORKDIR /go
VOLUME /go
WORKDIR /goproxy
VOLUME /goproxy
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/goproxy"]
CMD ["server", "--address", ":8080"]