Merge pull request #344 from kookmin-sw/hotfix-kakao #107
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 Build and Push | |
on: | |
push: | |
branches: | |
- 'develop' | |
paths: | |
- 'backend/**' | |
- '.github/workflows/main.yml' | |
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: 'temurin' | |
cache: 'gradle' | |
working-directory: ./backend | |
- name: Decode and Save Firebase Config | |
run: | | |
mkdir -p ./backend/src/main/resources/firebase | |
echo "${{ secrets.FIREBASE_CONFIG_BASE64 }}" | base64 -d > ./backend/src/main/resources/firebase/firebase-secret-key.json | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
working-directory: ./backend | |
- name: Build with Gradle | |
run: ./gradlew build | |
working-directory: ./backend | |
env: | |
SPRING_DATASOURCE_URL: ${{ secrets.SPRING_DATASOURCE_URL }} | |
SPRING_DATASOURCE_USERNAME: ${{ secrets.SPRING_DATASOURCE_USERNAME }} | |
SPRING_DATASOURCE_PASSWORD: ${{ secrets.SPRING_DATASOURCE_PASSWORD }} | |
REDIS_HOST : ${{secrets.REDIS_HOST}} | |
JWT_SECRETKEY : ${{secrets.JWT_SECRETKEY}} | |
AWS_ACCESS_KEY : ${{secrets.AWS_ACCESS_KEY}} | |
AWS_SECRET_KEY : ${{secrets.AWS_SECRET_KEY}} | |
EMAIL_USERNAME : ${{secrets.EMAIL_USERNAME}} | |
EMAIL_PASSWORD : ${{secrets.EMAIL_PASSWORD}} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: spring-app-artifacts | |
path: build/libs/*.jar | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./backend | |
file: ./backend/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/spring-app:latest | |
- name: Send Portainer restart spring-container Trigger | |
run: | | |
curl -X POST ${{ secrets.PORTAINER_WEBHOOK_LINK }} | |
- name: Clean up Gradle Cache | |
run: ./gradlew clean | |
working-directory: ./backend |