build_gh_actions_image_base #3
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
name: build_gh_actions_image_base | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "04 05 * * 6" | |
jobs: | |
build: | |
runs-on: [ self-hosted, linux ] | |
permissions: | |
packages: write | |
steps: | |
- name: 'Make tmp dir' | |
run: mkdir -p build_context | |
- run: | | |
echo " | |
FROM debian:bookworm | |
RUN export DEBIAN_FRONTEND=noninteractive && \ | |
apt-get update && \ | |
apt-get install --yes curl gpg ca-certificates && \ | |
install -m 0755 -d /etc/apt/keyrings && \ | |
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \ | |
chmod a+r /etc/apt/keyrings/docker.gpg && \ | |
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian/ bookworm stable" > /etc/apt/sources.list.d/docker.list && \ | |
apt-get update && \ | |
apt-get install --yes docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin && \ | |
apt-get clean && \ | |
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
" > build_context/Dockerfile | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: build_context/ | |
push: true | |
tags: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/debian_docker:latest" | |
- name: cleanup | |
if: always() | |
run: rm -rf build_context |