Skip to content

Commit

Permalink
feat: template-dockerfiles tool for building
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Gągor committed Dec 15, 2024
1 parent 0ac53e3 commit 952770b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 30 deletions.
30 changes: 5 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,11 @@ jobs:
run: |
echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
# build
docker build \
--build-arg TAG=${{ matrix.tag }} \
--tag tgagor/centos:${{ matrix.tag }} ${{ matrix.tag }}/
# squash
docker run --name tgagor-${{ matrix.tag }} tgagor/centos:${{ matrix.tag }} true
docker export tgagor-${{ matrix.tag }} | docker import \
--change 'CMD ["/bin/bash"]' \
--change 'LABEL maintainer="Tomasz Gągor <https://timor.site>"' \
--change 'LABEL org.opencontainers.image.authors="Tomasz Gągor"' \
--change 'LABEL org.opencontainers.image.licenses=GPL-2.0' \
--change "LABEL org.opencontainers.image.version=$DOCKER_TAG" \
--change "LABEL org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
--change "LABEL org.opencontainers.image.url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
--change "LABEL org.opencontainers.image.revision=$GITHUB_SHA" \
--change "LABEL org.opencontainers.image.branch=${GITHUB_REF#refs/*/}" \
--change "LABEL org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
- tgagor/centos:${{ matrix.tag }}
# tag
docker tag tgagor/centos:${{ matrix.tag }} ghcr.io/tgagor/centos:${{ matrix.tag }}-${{ github.sha }}
# push
docker push ghcr.io/tgagor/centos:${{ matrix.tag }}-${{ github.sha }}
# fetch template-dockerfiles
curl -sf -o /usr/local/bin/td https://github.com/tgagor/template-dockerfiles/releases/latest/download/td-linux-amd64
chmod +x /usr/local/bin/td
td --config build.yaml --tag $DOCKER_TAG --push
security-scan:
runs-on: ubuntu-22.04
Expand Down
3 changes: 1 addition & 2 deletions stream9/Dockerfile → Dockerfile.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG TAG=stream
FROM quay.io/centos/centos:$TAG
FROM quay.io/centos/centos:{{ .centos }}

# upgrade packages
RUN dnf upgrade --setopt=install_weak_deps=False -y && \
Expand Down
32 changes: 32 additions & 0 deletions build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
registry: ghcr.io
prefix: tgagor
maintainer: Tomasz Gągor <https://gagor.pro>

labels:
org.opencontainers.image.licenses: GPL-2.0-only
org.opencontainers.image.url: https://hub.docker.com/repository/docker/tgagor/centos/general
org.opencontainers.image.documentation: https://github.com/tgagor/docker-centos/blob/master/README.md
org.opencontainers.image.title: Weekly updated CentOS Docker images
org.opencontainers.image.description: |
Those images are just standard CentOS base images, but:
1. With all the package updates installed weekly.
2. Squashed to single layer for smaller size.
images:
centos:
dockerfile: Dockerfile.tpl
variables:
centos:
- stream9
- stream10
tags:
- centos:{{ .centos }}
- centos:{{ .centos | trimPrefix "stream" }}
- centos:{{ .tag }}-{{ .centos }}
- centos:{{ .tag }}
- centos:stream
- centos:latest
labels:
org.opencontainers.image.base.name: quay.io/centos/centos:{{ .centos }}
1 change: 0 additions & 1 deletion stream10

This file was deleted.

1 change: 0 additions & 1 deletion stream10-development

This file was deleted.

1 change: 0 additions & 1 deletion stream9/stream9

This file was deleted.

0 comments on commit 952770b

Please sign in to comment.