Added support for PR builds on master (#3363)

* added support for PR builds on master

* add linefeed to .dockerignore

* single dockerfile

* fix dockerfile ref

* update for java 17 lts
This commit is contained in:
Ben Curtis
2023-10-04 20:14:56 -04:00
committed by GitHub
parent bc7394080d
commit cc5a8bad17
6 changed files with 77 additions and 19 deletions

43
.github/workflows/docker-beta.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: Build and push docker (beta)
on:
pull_request:
branches: [master]
types: [closed]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_and_push:
name: Build and push
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get hash
id: hash
run: echo "APKTOOL_HASH=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
file: ./docker/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.APKTOOL_HASH }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:beta
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:master

View File

@ -1,17 +1,9 @@
name: Build and push docker
name: Build and push docker (release)
on:
release:
types: [published]
# Use the below to integrate into a Beta build from master
# Changes to the Dockerfile to use the manually built Jar
# from the build automation would be required.
# on:
# pull_request:
# branches: [master]
# types: [closed]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
@ -45,9 +37,10 @@ jobs:
with:
context: .
platforms: linux/amd64
file: ./Dockerfile
file: ./docker/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.APKTOOL_HASH }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.APKTOOL_TAG }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:prod
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest