mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 10:19:35 +00:00
Use multi-stage Dockerfile for image build
* Go build the Matchbox binary in the container image in a docker.io/golang builder stage rather building the binary separately
This commit is contained in:
@@ -1,2 +1,7 @@
|
||||
*
|
||||
!bin/matchbox
|
||||
bin/
|
||||
contrib/
|
||||
docs/
|
||||
examples/
|
||||
scripts/
|
||||
_output/
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
FROM docker.io/golang:1.14.9 AS builder
|
||||
COPY . src
|
||||
RUN cd src && make build
|
||||
|
||||
FROM docker.io/alpine:3.12
|
||||
LABEL maintainer="Dalton Hubble <dghubble@gmail.com>"
|
||||
COPY bin/matchbox /matchbox
|
||||
COPY --from=builder /go/src/bin/matchbox /matchbox
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/matchbox"]
|
||||
|
||||
17
Makefile
17
Makefile
@@ -36,16 +36,15 @@ fmt:
|
||||
@test -z $$(go fmt ./...)
|
||||
|
||||
.PHONY: image
|
||||
image:
|
||||
@buildah bud -t $(LOCAL_REPO):$(VERSION) .
|
||||
@buildah tag $(LOCAL_REPO):$(VERSION) $(LOCAL_REPO):latest
|
||||
image: \
|
||||
image-amd64 \
|
||||
image-arm64
|
||||
|
||||
.PHONY: push
|
||||
push:
|
||||
@buildah tag $(LOCAL_REPO):$(VERSION) $(IMAGE_REPO):$(VERSION)
|
||||
@buildah tag $(LOCAL_REPO):$(VERSION) $(IMAGE_REPO):latest
|
||||
@buildah push docker://$(IMAGE_REPO):$(VERSION)
|
||||
@buildah push docker://$(IMAGE_REPO):latest
|
||||
image-%:
|
||||
buildah bud -f Dockerfile \
|
||||
-t $(LOCAL_REPO):$(VERSION)-$* \
|
||||
--arch $* --override-arch $* \
|
||||
--format=docker .
|
||||
|
||||
.PHONY: update
|
||||
update:
|
||||
|
||||
Reference in New Issue
Block a user