d2040789e5
Replace the packer-images gobuilder with a Dockerfile matrix built on each container-base distro image, on a single repo semver. - install golang, gcc and nfpm - bake the sha256-pinned go-cache-plugin v0.1.0 binary onto PATH - run in-image assertions as a --target test build stage - add pull_request build/test/pre-commit and tag-triggered docker workflows
31 lines
1.2 KiB
Docker
31 lines
1.2 KiB
Docker
# syntax=docker/dockerfile:1
|
|
ARG REGISTRY=artifactapi.k8s.syd1.au.unkin.net/docker-internal
|
|
# The container-base release this image is built on — the one place to bump it.
|
|
ARG BASE_VERSION=0.1.0
|
|
ARG BASE_IMAGE_NAME=almalinux9
|
|
|
|
FROM ${REGISTRY}/${BASE_IMAGE_NAME}:${BASE_VERSION} AS image
|
|
ARG DISTRO=alma9
|
|
ARG GO_CACHE_PLUGIN_VERSION=v0.1.0
|
|
ARG GO_CACHE_PLUGIN_SHA256=0eb23d06a0dcf395559cb6447864579c220e60148fdcd6a6f841c2b17169b9b8
|
|
COPY distros/${DISTRO}/ /tmp/distro/
|
|
RUN set -eux; \
|
|
. /tmp/distro/distro.env; \
|
|
dnf install -y $PACKAGES; \
|
|
dnf clean all; \
|
|
curl -fsSL -o /usr/local/bin/go-cache-plugin \
|
|
"https://git.unkin.net/unkin/go-cache-plugin/releases/download/${GO_CACHE_PLUGIN_VERSION}/go-cache-plugin-linux-amd64"; \
|
|
echo "$GO_CACHE_PLUGIN_SHA256 /usr/local/bin/go-cache-plugin" | sha256sum -c -; \
|
|
chmod 0755 /usr/local/bin/go-cache-plugin; \
|
|
rm -rf /var/cache/dnf /tmp/distro
|
|
CMD ["/bin/bash"]
|
|
|
|
# Built only via `--target test`; assertions run as a build step so a broken image
|
|
# fails the build, with no docker daemon needed in CI.
|
|
FROM image AS test
|
|
ARG DISTRO=alma9
|
|
COPY distros/${DISTRO}/distro.env test.sh /tmp/test/
|
|
RUN cd /tmp/test && ./test.sh
|
|
|
|
FROM image AS final
|