add new Dockerfile with multi-stage build that produces a single binary docker image
This commit is contained in:
parent
26e2df7c77
commit
e62dbbda94
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- checkout
|
- checkout
|
||||||
- docker/build:
|
- docker/build:
|
||||||
image: pboehm/ddns
|
image: pboehm/ddns
|
||||||
dockerfile: docker/ddns/Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
|
||||||
docker-build-and-push:
|
docker-build-and-push:
|
||||||
executor: docker/docker
|
executor: docker/docker
|
||||||
|
@ -28,7 +28,7 @@ jobs:
|
||||||
- docker/check
|
- docker/check
|
||||||
- docker/build:
|
- docker/build:
|
||||||
image: pboehm/ddns
|
image: pboehm/ddns
|
||||||
dockerfile: docker/ddns/Dockerfile
|
dockerfile: Dockerfile
|
||||||
tag: $CIRCLE_SHA1,latest
|
tag: $CIRCLE_SHA1,latest
|
||||||
- docker/push:
|
- docker/push:
|
||||||
image: pboehm/ddns
|
image: pboehm/ddns
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
FROM golang:alpine AS builder
|
||||||
|
|
||||||
|
RUN apk add --no-cache git
|
||||||
|
|
||||||
|
WORKDIR /go/src/github.com/pboehm/ddns
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN GO111MODULE=on go get -d -v ./...
|
||||||
|
RUN export CGO_ENABLED=0 && GO111MODULE=on go install -v ./...
|
||||||
|
|
||||||
|
ENV GIN_MODE release
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=builder /go/bin/ddns /go/bin/ddns
|
||||||
|
|
||||||
|
ENTRYPOINT ["/go/bin/ddns"]
|
Loading…
Reference in New Issue