Skip to content

Commit a47e52c

Browse files
der-eismannvladak
authored andcommitted
Replace docker.sh script with GitHub Actions
1 parent 3a89933 commit a47e52c

File tree

2 files changed

+24
-104
lines changed

2 files changed

+24
-104
lines changed

.github/workflows/docker.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Docker image
33
on: [push, pull_request]
44

55
jobs:
6-
ubuntu:
6+
container:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout master branch
@@ -26,14 +26,30 @@ jobs:
2626
run: black --check docker/*.py
2727
- name: Run isort in check mode
2828
run: isort --settings-file docker/.isort.cfg docker/*.py --check --diff
29+
- name: Running linter
30+
run: docker run --rm -i hadolint/hadolint:2.6.0 < Dockerfile || exit 1
31+
- name: Docker metadata generation
32+
id: meta
33+
uses: docker/metadata-action@v4
34+
with:
35+
images: |
36+
${{ github.repository }}
37+
tags: |
38+
type=ref,event=branch
39+
type=ref,event=pr
40+
type=semver,pattern={{version}}
41+
type=semver,pattern={{major}}.{{minor}}
42+
- name: Login to Docker Hub
43+
if: ${{ github.repository == 'oracle/opengrok' && github.event_name == 'push' }}
44+
uses: docker/login-action@v2
45+
with:
46+
username: ${{ secrets.DOCKER_USERNAME }}
47+
password: ${{ secrets.DOCKER_PASSWORD }}
2948
- name: Build and optionally push Docker image
30-
env:
31-
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
32-
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
33-
OPENGROK_REPO_SLUG: ${{ github.repository }}
34-
OPENGROK_PULL_REQUEST: ${{ github.head_ref }}
35-
OPENGROK_REF: ${{ github.ref }}
36-
run: ./dev/docker.sh
49+
uses: docker/build-push-action@v4
50+
with:
51+
push: ${{ github.repository == 'oracle/opengrok' && github.event_name == 'push' }}
52+
tags: ${{ steps.meta.outputs.tags }}
3753
- name: Install Python pre-requisites
3854
run: python3 -m pip install requests
3955
- name: Optionally update README on Docker hub

dev/docker.sh

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)