[FIX] Dockerfile Jar 파일 경로 수정 #20
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: rhkr8521 - CI | |
on: | |
push: | |
branches: [ "develop" ] | |
pull_request: | |
branches: [ "develop" ] | |
permissions: | |
contents: read | |
jobs: | |
# Spring Boot application build and Docker image push process | |
build-docker-image: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# 1. Set up JDK 17 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
# 2. Create application.yml file | |
- name: Create application.yml | |
run: | | |
mkdir -p ./ChargeControlBackend/src/main/resources | |
echo "${{ secrets.APPLICATION_YML }}" > ./ChargeControlBackend/src/main/resources/application.yml | |
cat ./ChargeControlBackend/src/main/resources/application.yml | |
shell: bash | |
# 3. Build Spring Boot application | |
- name: Build with Gradle | |
run: | | |
chmod +x ./ChargeControlBackend/gradlew | |
./ChargeControlBackend/gradlew clean bootJar --project-dir ./ChargeControlBackend | |
shell: bash | |
# 4. Build Docker image | |
- name: Docker image build | |
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/chargecontrol_backend ./ChargeControlBackend | |
# 5. DockerHub login | |
- name: Docker login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
# 6. Push Docker image to DockerHub | |
- name: Docker Hub push | |
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/chargecontrol_backend |