Created
July 27, 2019 05:35
-
-
Save ivancorrales/1ebdd14cc318db22824ea1f399ddbdb1 to your computer and use it in GitHub Desktop.
a multi-stage build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.12.5 AS ci-lint | |
ENV CGO_ENABLED=0 GOFLAGS="-mod=vendor" | |
WORKDIR /app | |
ADD . /app | |
RUN go run github.com/golangci/golangci-lint/cmd/golangci-lint run --verbose | |
FROM golang:1.12.5 AS ci-test_unit | |
ENV CGO_ENABLED=0 GOFLAGS="-mod=vendor" | |
WORKDIR /app | |
ADD . /app | |
RUN go test -v ./... | |
FROM golang:1.12.5 AS ci-build | |
ENV CGO_ENABLED=0 GOFLAGS="-mod=vendor" | |
WORKDIR /app | |
ADD . /app | |
RUN go build -o /build/demo.linux main.go | |
FROM golang:1.12.5 | |
EXPOSE 3000 | |
WORKDIR /opt/app/bin | |
COPY --from=ci-build /build/demo.linux ./demo | |
ENTRYPOINT ./demo | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment