-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor container infrastructure (#5)
* Refactor container infrastructure * Add retention action
- Loading branch information
Showing
10 changed files
with
277 additions
and
249 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: buildah-build-devel | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "19 19 * * 0" # 19:41 UTC everyday | ||
push: | ||
paths: | ||
- .github/workflows/buildah-build-devel.yml # Self-trigger | ||
- containers/rvstd-devel/Dockerfile | ||
|
||
env: | ||
REGISTRY: ghcr.io/bounverif | ||
IMAGE_NAME: rvstd | ||
RVSTD_VERSION: latest | ||
CONTAINERS_ROOT: /home/runner/.local/share/containers | ||
TMPDIR: /home/runner/.local/share/containers/tmp | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
buildah-build-devel: | ||
runs-on: ubuntu-24.04 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
steps: | ||
- name: Maximize build space | ||
uses: easimon/maximize-build-space@v10 | ||
with: | ||
root-reserve-mb: 2048 # Reserve disk space for repository | ||
remove-dotnet: "true" | ||
remove-android: "true" | ||
remove-haskell: "true" | ||
remove-codeql: "true" | ||
remove-docker-images: "true" | ||
build-mount-path: ${{ env.CONTAINERS_ROOT }} # The remaining space only for container build | ||
|
||
- run: mkdir -p $TMPDIR | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set current date as the version | ||
run: echo "RVSTD_VERSION=$(date +'%Y%m%d')" >> $GITHUB_ENV | ||
|
||
- name: Log in to the GitHub Container registry | ||
uses: redhat-actions/podman-login@v1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build builder container image | ||
id: build-builder | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
platforms: linux/amd64 | ||
image: ${{ env.IMAGE_NAME }} | ||
tags: ${{ env.RVSTD_VERSION }}-builder latest-builder | ||
layers: true | ||
oci: true | ||
build-args: | | ||
RVSTD_VERSION=${{ env.RVSTD_VERSION }} | ||
extra-args: | | ||
--target rvstd-builder | ||
containerfiles: | | ||
containers/rvstd-devel/Dockerfile | ||
- name: Build devel container image | ||
id: build-devel | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
platforms: linux/amd64 | ||
image: ${{ env.IMAGE_NAME }} | ||
tags: ${{ env.RVSTD_VERSION }}-devel latest-devel | ||
layers: true | ||
oci: true | ||
build-args: | | ||
RVSTD_VERSION=${{ env.RVSTD_VERSION }} | ||
extra-args: | | ||
--target rvstd-devel | ||
containerfiles: | | ||
containers/rvstd-devel/Dockerfile | ||
- name: Push to GitHub Container Repository | ||
if: github.ref == 'refs/heads/main' | ||
id: push-builder-ghcr | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
image: ${{ steps.build-builder.outputs.image }} | ||
tags: ${{ steps.build-builder.outputs.tags }} | ||
|
||
- name: Push to GitHub Container Repository | ||
if: github.ref == 'refs/heads/main' | ||
id: push-devel-ghcr | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
image: ${{ steps.build-devel.outputs.image }} | ||
tags: ${{ steps.build-devel.outputs.tags }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: ghcr-retention | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 12 * * 0" | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
clean: | ||
runs-on: ubuntu-latest | ||
name: Github Container Registry Retention Policy | ||
steps: | ||
- name: Clean up old images | ||
uses: snok/[email protected] | ||
with: | ||
account: bounverif | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
image-names: "rvstd" | ||
image-tags: "!latest*" | ||
cut-off: 24w | ||
dry-run: false | ||
|
||
- name: Clean up untagged images | ||
uses: snok/[email protected] | ||
with: | ||
account: bounverif | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
image-names: "rvstd" | ||
tag-selection: untagged | ||
cut-off: 1h | ||
dry-run: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
RVSTD_IMAGE_NAME ?= localhost/rvstd | ||
RVSTD_VERSION ?= latest | ||
CONTEXT ?= . | ||
CONTAINER_CACHE_TTL=24h | ||
|
||
builder: | ||
buildah build \ | ||
-f rvstd-devel/Dockerfile \ | ||
--build-arg RVSTD_IMAGE_NAME=${RVSTD_IMAGE_NAME} \ | ||
--build-arg RVSTD_VERSION=${RVSTD_VERSION} \ | ||
--format oci \ | ||
--layers=true \ | ||
--cache-ttl=${CONTAINER_CACHE_TTL} \ | ||
--target rvstd-builder \ | ||
--tag rvstd:${RVSTD_VERSION}-builder \ | ||
${CONTEXT} | ||
|
||
devel: builder | ||
buildah build \ | ||
-f rvstd-devel/Dockerfile \ | ||
--build-arg RVSTD_IMAGE_NAME=${RVSTD_IMAGE_NAME} \ | ||
--build-arg RVSTD_VERSION=${RVSTD_VERSION} \ | ||
--format oci \ | ||
--layers=true \ | ||
--cache-ttl=${CONTAINER_CACHE_TTL} \ | ||
--target rvstd-devel \ | ||
--tag rvstd:${RVSTD_VERSION}-devel \ | ||
${CONTEXT} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.