This repository has been archived by the owner on Apr 27, 2024. It is now read-only.
Merge pull request #237 from WisdomWorks/dev #172
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: Build and Push to Docker Hub | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Build with Maven | |
run: ./mvnw clean package -DskipTests | |
- name: Build Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./.docker/Dockerfile | |
push: false | |
tags: ${{ secrets.DOCKER_USERNAME }}/codee-be:latest | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./.docker/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/codee-be:latest |