alpine carry its own hash

Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
Avi Deitcher 2021-05-02 19:44:39 +03:00
parent b5429604b6
commit 1e99ba3dce
2 changed files with 5 additions and 4 deletions

View File

@ -93,6 +93,8 @@ RUN set -e && \
FROM alpine:3.13
ARG TARGETARCH
COPY --from=mirror /etc/apk/repositories /etc/apk/repositories
COPY --from=mirror /etc/apk/repositories.upstream /etc/apk/repositories.upstream
COPY --from=mirror /etc/apk/keys /etc/apk/keys/
@ -104,4 +106,6 @@ COPY --from=mirror /iucode_tool /usr/bin/
RUN apk update && apk upgrade -a
RUN echo Dockerfile /lib/apk/db/installed $(find /mirror -name '*.apk' -type f) $(find /go/bin -type f) | xargs cat | sha1sum | sed 's/ .*//' | sed 's/$/-${TARGETARCH}/' > /etc/alpine-hash
ENV GOPATH=/go PATH=$PATH:/go/bin

View File

@ -7,15 +7,12 @@ DEPS=packages
ARCH := $(shell uname -m)
ifeq ($(ARCH), x86_64)
DEPS += packages.x86_64
SUFFIX=-amd64
endif
ifeq ($(ARCH), aarch64)
DEPS += packages.aarch64
SUFFIX=-arm64
endif
ifeq ($(ARCH), s390x)
DEPS += packages.s390x
SUFFIX=-s390x
endif
default: push
@ -27,7 +24,7 @@ iid: Dockerfile Makefile $(DEPS)
docker build --no-cache --iidfile iid .
hash: Makefile iid
docker run --rm $(shell cat iid) sh -c 'echo Dockerfile /lib/apk/db/installed $$(find /mirror -name '*.apk' -type f) $$(find /go/bin -type f) | xargs cat | sha1sum' | sed 's/ .*//' | sed 's/$$/$(SUFFIX)/'> $@
docker run --rm $(shell cat iid) cat /etc/alpine-hash > $@
versions.$(ARCH): Makefile hash iid
echo "# $(ORG)/$(IMAGE):$(shell cat hash)" > versions.$(ARCH)