Merge: 채팅메시지 정렬순서 변경 #27
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 cicd | |
on: | |
push: | |
branches: [ "develop" ] | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }} | |
jobs: | |
build: | |
name: docker build | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
- name: docker login | |
run: | | |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD | |
- name: build the docker image | |
run: | | |
docker build -t $DOCKER_USER/$DOCKER_IMAGE:latest . | |
- name: docker push | |
run: | | |
docker push $DOCKER_USER/$DOCKER_IMAGE:latest | |
deploy: | |
name: deploy to EC2 | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: executing remote ssh commands | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
script: | | |
docker pull ${{ secrets.DOCKER_USER }}/${{ secrets.DOCKER_IMAGE }}:latest | |
docker rm -f ${{ secrets.BE_CONTAINER }} | |
docker run -d -p ${{ secrets.BE_PORT }}:${{ secrets.BE_PORT }} --name ${{ secrets.BE_CONTAINER }} --network ${{ secrets.BE_NETWORK }} -v ${{ secrets.BE_VOLUME }} ${{ secrets.DOCKER_USER }}/${{ secrets.DOCKER_IMAGE }}:latest | |