diff --git a/.github/workflows/push-docker-image.yaml b/.github/workflows/push-docker-image.yaml new file mode 100644 index 0000000..2d411b7 --- /dev/null +++ b/.github/workflows/push-docker-image.yaml @@ -0,0 +1,48 @@ +name: Docker + +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 + +jobs: + docker: + name: Build & Push Docker Image + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v2 + + - 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@v3 + with: + context: ${{ env.DOCKER-CONTEXT }} + file: ${{ env.DOCKER-FILE }} + tags: ghcr.io/${{ github.repository_owner }}/trainee:humble + build-args: USERNAME=runner + no-cache: true + push: true