mirror of https://github.com/goproxyio/goproxy
Fixed Dockerfile build and runtime
parent
26d189ed77
commit
5053e78599
28
Dockerfile
28
Dockerfile
|
@ -1,17 +1,23 @@
|
||||||
FROM golang:1.11 AS build
|
FROM golang:alpine AS build
|
||||||
|
|
||||||
COPY ./ /goproxy
|
RUN apk add --no-cache -U make
|
||||||
|
|
||||||
RUN cd /goproxy &&\
|
COPY . /src/goproxy
|
||||||
export GO111MODULE=on &&\
|
WORKDIR /src/goproxy
|
||||||
go generate &&\
|
|
||||||
go mod tidy &&\
|
|
||||||
go build
|
|
||||||
|
|
||||||
FROM alpine:3.8
|
ENV CGO_ENABLED=0
|
||||||
RUN apk add --no-cache git mercurial subversion bzr fossil
|
|
||||||
COPY --from=build /goproxy/goproxy /bin/goproxy
|
RUN make
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
RUN apk add --no-cache -U git mercurial subversion bzr fossil
|
||||||
|
|
||||||
|
COPY --from=build /src/goproxy/goproxy /goproxy
|
||||||
|
|
||||||
|
VOLUME /go
|
||||||
|
|
||||||
EXPOSE 8081
|
EXPOSE 8081
|
||||||
|
|
||||||
CMD ["goproxy"]
|
ENTRYPOINT ["/goproxy"]
|
||||||
|
CMD []
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
.PHONY: build generate image clean
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
build: generate
|
||||||
|
@go build -tags "netgo static_build" -installsuffix netgo -ldflags -w .
|
||||||
|
|
||||||
|
generate:
|
||||||
|
@go generate
|
||||||
|
|
||||||
|
image:
|
||||||
|
@docker build -t goproxy/goproxy .
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@git clean -f -d -X
|
|
@ -1,22 +1,22 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
PKG=${PWD}/internal
|
PKG="${PWD}/internal"
|
||||||
GOROOT=`go env GOROOT`
|
GOROOT="$(go env GOROOT)"
|
||||||
|
|
||||||
mkdir -p ${PKG}
|
mkdir -p "${PKG}"
|
||||||
cp -r ${GOROOT}/src/cmd/go/internal/* ${PKG}
|
cp -r "${GOROOT}/src/cmd/go/internal/"* "${PKG}"
|
||||||
|
|
||||||
|
|
||||||
cp -r ${GOROOT}/src/cmd/internal/browser ${PKG}
|
cp -r "${GOROOT}/src/cmd/internal/browser" "${PKG}"
|
||||||
cp -r ${GOROOT}/src/cmd/internal/buildid ${PKG}
|
cp -r "${GOROOT}/src/cmd/internal/buildid" "${PKG}"
|
||||||
cp -r ${GOROOT}/src/cmd/internal/objabi ${PKG}
|
cp -r "${GOROOT}/src/cmd/internal/objabi" "${PKG}"
|
||||||
cp -r ${GOROOT}/src/cmd/internal/test2json ${PKG}
|
cp -r "${GOROOT}/src/cmd/internal/test2json" "${PKG}"
|
||||||
|
|
||||||
cp -r ${GOROOT}/src/internal/singleflight ${PKG}
|
cp -r "${GOROOT}/src/internal/singleflight" "${PKG}"
|
||||||
cp -r ${GOROOT}/src/internal/testenv ${PKG}
|
cp -r "${GOROOT}/src/internal/testenv" "${PKG}"
|
||||||
|
|
||||||
|
|
||||||
find ${PKG} -type f -name '*.go' -exec sed -i 's/cmd\/go\/internal/github.com\/goproxyio\/goproxy\/internal/g' {} +
|
find "${PKG}" -type f -name '*.go' -exec sed -i -e 's/cmd\/go\/internal/github.com\/goproxyio\/goproxy\/internal/g' {} +
|
||||||
find ${PKG} -type f -name '*.go' -exec sed -i 's/cmd\/internal/github.com\/goproxyio\/goproxy\/internal/g' {} +
|
find "${PKG}" -type f -name '*.go' -exec sed -i -e 's/cmd\/internal/github.com\/goproxyio\/goproxy\/internal/g' {} +
|
||||||
find ${PKG} -type f -name '*.go' -exec sed -i 's/internal\/singleflight/github.com\/goproxyio\/goproxy\/internal\/singleflight/g' {} +
|
find "${PKG}" -type f -name '*.go' -exec sed -i -e 's/internal\/singleflight/github.com\/goproxyio\/goproxy\/internal\/singleflight/g' {} +
|
||||||
find ${PKG} -type f -name '*.go' -exec sed -i 's/internal\/testenv/github.com\/goproxyio\/goproxy\/internal\/testenv/g' {} +
|
find "${PKG}" -type f -name '*.go' -exec sed -i -e 's/internal\/testenv/github.com\/goproxyio\/goproxy\/internal\/testenv/g' {} +
|
||||||
|
|
Loading…
Reference in New Issue