cd: Dockerfile 일반 배포로 변경 #97
Workflow file for this run
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: Push Server Image | |
on: | |
push: | |
branches: | |
- dev/service-server # 서버 별로 변경 필요 | |
pull_request: | |
branches: | |
- dev/service-server # 서버 별로 변경 필요 | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
SERVER_NAME: service-server # 서버 별로 변경 필요 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Log in to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.DOCKERHUB_USERNAME }} | |
password: ${{ env.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
run: | | |
cd src/backend | |
docker build -t ${{ env.DOCKERHUB_USERNAME }}/${{ env.SERVER_NAME }}:latest -f ${{ env.SERVER_NAME }}/Dockerfile . | |
docker push ${{ env.DOCKERHUB_USERNAME }}/${{ env.SERVER_NAME }}:latest |