64 lines
2 KiB
YAML
64 lines
2 KiB
YAML
|
name: Docker Image CI
|
||
|
|
||
|
on:
|
||
|
push:
|
||
|
branches: ['main']
|
||
|
pull_request:
|
||
|
|
||
|
env:
|
||
|
REGISTRY: git.dc09.ru # Change to your registry (e.g., forgejo.example.com)
|
||
|
ORGANIZATION: nm17 # Docker Hub organization or Forgejo username
|
||
|
GITHUB_TOKEN: ${{ secrets.DOCKER_PASSWORD }}
|
||
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKER_PASSWORD }}
|
||
|
DOCKER_TOKEN: ${{ secrets.DOCKER_PASSWORD }}
|
||
|
FORGEJO_URL: https://git.dc09.ru
|
||
|
|
||
|
jobs:
|
||
|
build-and-push:
|
||
|
runs-on: ubuntu-latest
|
||
|
strategy:
|
||
|
matrix:
|
||
|
images:
|
||
|
- dockerfile: 'Dockerfile.openj9'
|
||
|
image_name: 'openj9'
|
||
|
context: './'
|
||
|
- dockerfile: 'Dockerfile.piped'
|
||
|
image_name: 'piped'
|
||
|
context: './'
|
||
|
# Add more images as needed
|
||
|
|
||
|
steps:
|
||
|
- name: Checkout repository
|
||
|
uses: actions/checkout@v4
|
||
|
|
||
|
- name: Log in to the Container registry
|
||
|
uses: docker/login-action@v3
|
||
|
with:
|
||
|
registry: ${{ env.REGISTRY }}
|
||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||
|
token: ${{ secrets.DOCKER_PASSWORD }}
|
||
|
opts.auth: ${{ secrets.DOCKER_PASSWORD }}
|
||
|
|
||
|
- name: Extract metadata (tags, labels)
|
||
|
id: meta
|
||
|
uses: docker/metadata-action@v5
|
||
|
with:
|
||
|
images: |
|
||
|
${{ env.REGISTRY }}/${{ env.ORGANIZATION }}/${{ matrix.image_name }}
|
||
|
tags: |
|
||
|
type=ref,event=branch
|
||
|
type=ref,event=pr
|
||
|
type=semver,pattern={{version}}
|
||
|
type=semver,pattern={{major}}.{{minor}}
|
||
|
github-token: ${{ secrets.DOCKER_PASSWORD }}
|
||
|
github-server: https://${{ env.REGISTRY }}
|
||
|
|
||
|
- name: Build and push Docker image
|
||
|
uses: docker/build-push-action@v5
|
||
|
with:
|
||
|
context: ${{ matrix.context }}
|
||
|
file: ${{ matrix.dockerfile }}
|
||
|
push: ${{ github.event_name == 'push' }}
|
||
|
tags: ${{ steps.meta.outputs.tags }}
|
||
|
labels: ${{ steps.meta.outputs.labels }}
|