Skip to content

Build

Build #206

name: Build
on:
workflow_dispatch:
schedule:
- cron: '0 9 * * *'
push:
branches:
- main
paths-ignore:
- '**/LICENSE'
- '**/*.md'
pull_request:
paths-ignore:
- '**/LICENSE'
- '**/*.md'
env:
DOCKER-CONTEXT: ./
DOCKER-FILE: ./Dockerfile
DOCKER-IMAGE: trainee
DOCKER-TAG: humble
jobs:
docker:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker image tag
run: echo "DOCKER_IMAGE_TAG=ghcr.io/$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')/${{ env.DOCKER-IMAGE }}:${{ env.DOCKER-TAG }}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v3
with:
context: ${{ env.DOCKER-CONTEXT }}
file: ${{ env.DOCKER-FILE }}
tags: ${{ env.DOCKER_IMAGE_TAG }}
build-args: USERNAME=runner
ssh: default=${{ env.SSH_AUTH_SOCK }}
no-cache: true
push: false