Skip to content

Merge pull request #167 from supercoding-commerce/dev #25

Merge pull request #167 from supercoding-commerce/dev

Merge pull request #167 from supercoding-commerce/dev #25

Workflow file for this run

name: Java CI
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: docker build and push
run: |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/commerce .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/commerce
#배포 Job
deploy:
needs: build # build 후에 실행되도록 정의
name: Deploy
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ubuntu
key: ${{ secrets.EC2_KEY }}
script: |
docker-compose down && docker rmi ${{ secrets.DOCKERHUB_USERNAME }}/commerce:latest
docker-compose up -d