Faster build
This commit is contained in:
parent
8d75e1450c
commit
53369058b9
@ -1,8 +1,6 @@
|
|||||||
# Build a small image
|
# Build a small image
|
||||||
FROM golang:alpine3.17 AS builder
|
FROM golang:alpine3.17 AS builder
|
||||||
|
|
||||||
ARG TARGETARCH
|
|
||||||
RUN echo "I'm building for $TARGETARCH"
|
|
||||||
WORKDIR /go/src
|
WORKDIR /go/src
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o bin/formolcli main.go
|
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o bin/formolcli main.go
|
||||||
|
|||||||
8
Dockerfile.amd64
Normal file
8
Dockerfile.amd64
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Build a small image
|
||||||
|
FROM alpine:3.17
|
||||||
|
RUN apk add --no-cache su-exec restic postgresql-client
|
||||||
|
COPY ./bin/formolcli /usr/local/bin
|
||||||
|
|
||||||
|
# Command to run
|
||||||
|
ENTRYPOINT ["/usr/local/bin/formolcli"]
|
||||||
|
CMD ["--help"]
|
||||||
11
Makefile
11
Makefile
@ -1,9 +1,10 @@
|
|||||||
GOARCH ?= amd64
|
GOARCH ?= amd64
|
||||||
GOOS ?= linux
|
GOOS ?= linux
|
||||||
IMG ?= desmo999r/formolcli:latest
|
IMG ?= docker.io/desmo999r/formolcli:latest
|
||||||
BINDIR = ./bin
|
BINDIR = ./bin
|
||||||
|
|
||||||
$(BINDIR)/formolcli: fmt vet
|
.PHONY: formolcli
|
||||||
|
formolcli: fmt vet
|
||||||
GO111MODULE=on CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(BINDIR)/formolcli main.go
|
GO111MODULE=on CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(BINDIR)/formolcli main.go
|
||||||
|
|
||||||
.PHONY: fmt
|
.PHONY: fmt
|
||||||
@ -15,12 +16,12 @@ vet:
|
|||||||
go vet ./...
|
go vet ./...
|
||||||
|
|
||||||
.PHONY: docker-build
|
.PHONY: docker-build
|
||||||
docker-build: $(BINDIR)/formolcli
|
docker-build: formolcli
|
||||||
buildah build --disable-compression --format=docker --platform $(GOOS)/$(GOARCH) -t $(IMG) .
|
buildah bud --disable-compression --format=docker --platform $(GOOS)/$(GOARCH) --manifest $(IMG) Dockerfile.$(GOARCH)
|
||||||
|
|
||||||
.PHONY: docker-push
|
.PHONY: docker-push
|
||||||
docker-push: docker-build
|
docker-push: docker-build
|
||||||
buildah push $(IMG)
|
buildah push $(IMG)
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(BINDIR)/formolcli docker-build
|
all: formolcli docker-build
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user