2020-04-11 21:27:24 +00:00
|
|
|
# build stage
|
|
|
|
FROM golang:1.13-stretch AS build-env
|
|
|
|
WORKDIR /src
|
2020-05-09 20:44:28 +00:00
|
|
|
|
2020-08-09 08:07:16 +00:00
|
|
|
COPY go.mod /src/go.mod
|
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
COPY . /src
|
|
|
|
|
2020-06-08 20:12:36 +00:00
|
|
|
#ENV GOPROXY=http://192.168.0.143:3000
|
2020-05-09 20:44:28 +00:00
|
|
|
|
2020-04-11 21:27:24 +00:00
|
|
|
ENV GO113MODULE=on
|
|
|
|
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go test ./... -cover -coverprofile=c.out #gosetup
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o goapp
|
|
|
|
|
|
|
|
# final stage
|
|
|
|
FROM alpine
|
|
|
|
LABEL maintainer="Alphyron <admin@dragon-labs.de>"
|
|
|
|
|
|
|
|
RUN apk update \
|
|
|
|
&& apk upgrade \
|
|
|
|
&& apk add --no-cache \
|
|
|
|
ca-certificates \
|
|
|
|
&& update-ca-certificates 2>/dev/null || true
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=build-env /src .
|
|
|
|
RUN chmod +x ./goapp
|
|
|
|
CMD [ "./goapp"]
|