Skip to content

Commit

Permalink
chore: local 환경 image 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
yechan-kim committed Nov 24, 2024
1 parent 3ac93d0 commit e43bf5d
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions .github/workflows/CI-CD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Create .env file
run: |
touch ./.env
echo "${{ secrets.ENV }}" > ./.env
echo "${{ secrets.ENV2 }}" > ./.env
shell: bash

- name: Install Dependencies
Expand All @@ -35,7 +35,7 @@ jobs:
context: .
dockerfile: Dockerfile
push: false
tags: ${{secrets.DOCKER_USERNAME}}/dpbrfe:latest
tags: ${{secrets.DOCKER_USERNAME}}/dpbrfe:local

- name: Docker Login
uses: docker/login-action@v3
Expand All @@ -49,29 +49,29 @@ jobs:
context: .
dockerfile: Dockerfile
push: true
tags: ${{secrets.DOCKER_USERNAME}}/dpbrfe:latest
tags: ${{secrets.DOCKER_USERNAME}}/dpbrfe:local

- name: Docker Deploy
uses: appleboy/ssh-action@master
with:
host: ${{secrets.HOST}}
username: ubuntu
key: ${{secrets.PEM_KEY}}
script: |
sudo docker pull ${{secrets.DOCKER_USERNAME}}/dpbrfe:latest
EXISTING_CONTAINER_ID=$(sudo docker ps -q -f "publish=3000" -f "status=running")
if [ ! -z "$EXISTING_CONTAINER_ID" ]; then
sudo docker stop $EXISTING_CONTAINER_ID
sudo docker rm $EXISTING_CONTAINER_ID
fi
EXISTING_CONTAINER_ID=$(sudo docker ps -q -f "publish=3000" -f "status=exited")
if [ ! -z "$EXISTING_CONTAINER_ID" ]; then
sudo docker rm $EXISTING_CONTAINER_ID
fi
sudo docker rm $(sudo docker ps --filter 'status=exited' -a -q)
sudo docker run -d --name dpbrfe -p 3000:3000 --net ${{secrets.DOCKER_NETWORK}} \
${{secrets.DOCKER_USERNAME}}/dpbrfe:latest
sudo docker image prune -a -f
# - name: Docker Deploy
# uses: appleboy/ssh-action@master
# with:
# host: ${{secrets.HOST}}
# username: ubuntu
# key: ${{secrets.PEM_KEY}}
# script: |
# sudo docker pull ${{secrets.DOCKER_USERNAME}}/dpbrfe:latest
#
# EXISTING_CONTAINER_ID=$(sudo docker ps -q -f "publish=3000" -f "status=running")
# if [ ! -z "$EXISTING_CONTAINER_ID" ]; then
# sudo docker stop $EXISTING_CONTAINER_ID
# sudo docker rm $EXISTING_CONTAINER_ID
# fi
#
# EXISTING_CONTAINER_ID=$(sudo docker ps -q -f "publish=3000" -f "status=exited")
# if [ ! -z "$EXISTING_CONTAINER_ID" ]; then
# sudo docker rm $EXISTING_CONTAINER_ID
# fi
#
# sudo docker rm $(sudo docker ps --filter 'status=exited' -a -q)
# sudo docker run -d --name dpbrfe -p 3000:3000 --net ${{secrets.DOCKER_NETWORK}} \
# ${{secrets.DOCKER_USERNAME}}/dpbrfe:latest
# sudo docker image prune -a -f

0 comments on commit e43bf5d

Please sign in to comment.