From f66d676f7e3a526d4ea62dc8b685f78638182057 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Fri, 20 Sep 2024 22:53:48 +0200 Subject: chore(tooling): Fixed container build layers caching --- .gitignore | 1 + Dockerfile | 9 +++------ GNUmakefile | 2 ++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index a4730c6..2cfc200 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +checksums ods diff --git a/Dockerfile b/Dockerfile index 0cf3598..990daf0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,11 +3,8 @@ FROM docker.io/library/golang:1.23-alpine WORKDIR /usr/src/app -COPY go.mod go.sum ./ -RUN go mod download && go mod verify - -COPY . . -RUN CGO_ENABLED=0 go build ./... +COPY checksums / +RUN CGO_ENABLED=0 go build -o /usr/local/bin/ods ./ ##### Run ###################################################################### FROM alpine:3.20 @@ -16,6 +13,6 @@ ENV LANG en_US.utf8 RUN apk upgrade --no-cache -COPY --from=0 /usr/src/app/ods /usr/local/bin/ +COPY --from=0 /usr/local/bin/ods /usr/local/bin/ ENTRYPOINT ["/usr/local/bin/ods"] diff --git a/GNUmakefile b/GNUmakefile index 7b7c475..1fd42c1 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -52,7 +52,9 @@ run: ## run the code ##### Containers ############################################################### .PHONY: container-build container-build: ## build the container image + printf "Dockerfile GNUmakefile go.mod go.sum index.html main.go ods.txt" | xargs shasum >checksums podman build \ + -v $$PWD:/usr/src/app \ -t $(CONTAINER_REGISTRY)/ods:$(CONTAINER_TAG) \ . -- cgit v1.2.3