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 &&\
|
||||
export GO111MODULE=on &&\
|
||||
go generate &&\
|
||||
go mod tidy &&\
|
||||
go build
|
||||
COPY . /src/goproxy
|
||||
WORKDIR /src/goproxy
|
||||
|
||||
FROM alpine:3.8
|
||||
RUN apk add --no-cache git mercurial subversion bzr fossil
|
||||
COPY --from=build /goproxy/goproxy /bin/goproxy
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
GOROOT=`go env GOROOT`
|
||||
PKG="${PWD}/internal"
|
||||
GOROOT="$(go env GOROOT)"
|
||||
|
||||
mkdir -p ${PKG}
|
||||
cp -r ${GOROOT}/src/cmd/go/internal/* ${PKG}
|
||||
mkdir -p "${PKG}"
|
||||
cp -r "${GOROOT}/src/cmd/go/internal/"* "${PKG}"
|
||||
|
||||
|
||||
cp -r ${GOROOT}/src/cmd/internal/browser ${PKG}
|
||||
cp -r ${GOROOT}/src/cmd/internal/buildid ${PKG}
|
||||
cp -r ${GOROOT}/src/cmd/internal/objabi ${PKG}
|
||||
cp -r ${GOROOT}/src/cmd/internal/test2json ${PKG}
|
||||
cp -r "${GOROOT}/src/cmd/internal/browser" "${PKG}"
|
||||
cp -r "${GOROOT}/src/cmd/internal/buildid" "${PKG}"
|
||||
cp -r "${GOROOT}/src/cmd/internal/objabi" "${PKG}"
|
||||
cp -r "${GOROOT}/src/cmd/internal/test2json" "${PKG}"
|
||||
|
||||
cp -r ${GOROOT}/src/internal/singleflight ${PKG}
|
||||
cp -r ${GOROOT}/src/internal/testenv ${PKG}
|
||||
cp -r "${GOROOT}/src/internal/singleflight" "${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 '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 's/internal\/testenv/github.com\/goproxyio\/goproxy\/internal\/testenv/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 -e 's/cmd\/internal/github.com\/goproxyio\/goproxy\/internal/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 -e 's/internal\/testenv/github.com\/goproxyio\/goproxy\/internal\/testenv/g' {} +
|
||||
|
|
Loading…
Reference in New Issue