This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
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 Docker Image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: gradlew 실행 권한 | |
run: chmod +x ./server/gradlew | |
- name: Build with Gradle | |
working-directory: ./server | |
run: ./gradlew bootjar | |
- name: List server directory contents | |
run: ls -la ./server # 이 단계에서 Dockerfile의 존재 여부를 확인 | |
- name: Log in to Docker Hub | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
- name: Build Docker image | |
run: docker build -f ./server/Dockerfile -t "${{ secrets.DOCKER_NICKNAME }}"/five:latest ./server | |
- name: Push Docker image | |
run: docker push "${{ secrets.DOCKER_NICKNAME }}"/five:latest |