chore(tooling): Fix container build layers caching

This commit is contained in:
Julien Dessaux 2024-09-20 22:53:48 +02:00
parent 7ac6c9c407
commit de7ba3439b
Signed by: adyxax
GPG key ID: F92E51B86E07177E
3 changed files with 6 additions and 6 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
checksums
ods ods

View file

@ -3,11 +3,8 @@ FROM docker.io/library/golang:1.23-alpine
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY go.mod go.sum ./ COPY checksums /
RUN go mod download && go mod verify RUN CGO_ENABLED=0 go build -o /usr/local/bin/ods ./
COPY . .
RUN CGO_ENABLED=0 go build ./...
##### Run ###################################################################### ##### Run ######################################################################
FROM alpine:3.20 FROM alpine:3.20
@ -16,6 +13,6 @@ ENV LANG en_US.utf8
RUN apk upgrade --no-cache 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"] ENTRYPOINT ["/usr/local/bin/ods"]

View file

@ -52,7 +52,9 @@ run: ## run the code
##### Containers ############################################################### ##### Containers ###############################################################
.PHONY: container-build .PHONY: container-build
container-build: ## build the container image container-build: ## build the container image
printf "Dockerfile GNUmakefile go.mod go.sum index.html main.go ods.txt" | xargs shasum >checksums
podman build \ podman build \
-v $$PWD:/usr/src/app \
-t $(CONTAINER_REGISTRY)/ods:$(CONTAINER_TAG) \ -t $(CONTAINER_REGISTRY)/ods:$(CONTAINER_TAG) \
. .