Skip to content

99.1.1

99.1.1 #1

Workflow file for this run

name: Build Docker image
on:
push:
pull_request:
release:
types: [created]
jobs:
ubuntu:
runs-on: ubuntu-latest
steps:
- name: Print environment
shell: bash
run: env
- name: Checkout master branch
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: python3 -m pip install -r docker/requirements.txt
- name: Install opengrok-tools so that pylint can perform the checks
run: python3 -m pip install .
working-directory: tools
- name: Install checkers
run: python3 -m pip install pylint flake8 black isort
- name: Run flake8
run: flake8 --max-line-length 119 docker/*.py
- name: Run pylint
run: pylint -E --max-line-length 119 docker/*.py
- name: Run black in check mode
run: black --check docker/*.py
- name: Run isort in check mode
run: isort --settings-file docker/.isort.cfg docker/*.py --check --diff
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
if: env.DOCKER_USERNAME != ''
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.DOCKERHUB_SLUG }}
ghcr.io/${{ github.repository}}
tags: |
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
type=pep440,pattern={{version}},enable=${{ github.event_name == 'release' }}
type=pep440,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' }}
type=ref,event=branch
type=ref,event=pr
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'release' || (github.event_name == 'push' && github.ref == 'refs/heads/master') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}