Make RESTIC_VERSION an argument

This commit is contained in:
2023-04-06 12:46:38 +02:00
parent 96377203b0
commit 1a99bba3c5
2 changed files with 4 additions and 5 deletions

View File

@@ -1,7 +1,6 @@
ARG RESTIC_VERSION=0.15.1
FROM golang:1.19-alpine AS builder FROM golang:1.19-alpine AS builder
ENV RESTIC_VERSION 0.15.1
RUN apk add --no-cache git RUN apk add --no-cache git
RUN git clone --depth 1 --branch v${RESTIC_VERSION} https://github.com/restic/restic.git /go/src/github.com/restic/restic RUN git clone --depth 1 --branch v${RESTIC_VERSION} https://github.com/restic/restic.git /go/src/github.com/restic/restic

View File

@@ -1,5 +1,5 @@
ORG ?= genunix ORG ?= genunix
VERSION = $(shell grep "ENV RESTIC_VERSION" Dockerfile | awk '{print $$3}') VERSION ?= $(shell grep "ARG RESTIC_VERSION" Dockerfile | cut -d = -f 2)
PLATFORMS ?= linux/arm/v7,linux/arm64/v8,linux/amd64 PLATFORMS ?= linux/arm/v7,linux/arm64/v8,linux/amd64
build-all: print-version build-version build-latest build-all: print-version build-version build-latest
@@ -8,7 +8,7 @@ print-version:
@echo "Building $(ORG)/restic:$(VERSION) for $(PLATFORMS)" @echo "Building $(ORG)/restic:$(VERSION) for $(PLATFORMS)"
build-version: build-version:
docker buildx build --push --platform $(PLATFORMS) --tag $(ORG)/restic:$(VERSION) . docker buildx build --build-arg RESTIC_VERSION=$(VERSION) --push --platform $(PLATFORMS) --tag $(ORG)/restic:$(VERSION) .
build-latest: build-latest:
docker buildx build --push --platform $(PLATFORMS) --tag $(ORG)/restic:latest . docker buildx build --build-arg RESTIC_VERSION=$(VERSION) --push --platform $(PLATFORMS) --tag $(ORG)/restic:latest .