Docker Image CI #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- 'backend/**' | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- 'backend/**' | |
workflow_dispatch: | |
jobs: | |
publish-docker-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Build with Maven | |
run: mvn clean package | |
working-directory: ./backend | |
- name: Login to Github Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghrc.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build docker image | |
run: | | |
docker build . --tag ghcr.io/chrislolz/matchguessr:latest | |
docker push ghcr.io/chrislolz/matchguessr:latest | |
working-directory: ./backend |