Skip to content

Commit

Permalink
Merge pull request #95 from MEME-UMC/ci/#78
Browse files Browse the repository at this point in the history
[CI] CI/CD #95
  • Loading branch information
sunwupark authored Feb 3, 2024
2 parents 8541b02 + d3dd134 commit b71b285
Showing 1 changed file with 5 additions and 28 deletions.
33 changes: 5 additions & 28 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,32 +52,8 @@ jobs:
sudo docker rmi -f $(sudo docker images -aq)
fi
- name: Copy file to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ec2-user
key: ${{ secrets.KEY }}
source: ./docker-compose.yaml
target: /home/ec2-user/

- name: Create and Copy .env File to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ec2-user
key: ${{ secrets.KEY }}
script: |
# Create .env file
echo "DB_URL=${{ secrets.DB_URL }}" > ~/.env
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> ~/.env
echo "DB_PASS=${{ secrets.DB_PASS }}" >> ~/.env
# Copy .env file to the project directory
#cp ~/.env /home/ec2-user/.env
## docker compose up
- name: Docker Compose on EC2
- name: Docker Run on EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
Expand All @@ -86,10 +62,11 @@ jobs:
script: |
# Docker 이미지 다운로드
sudo docker pull ${{ secrets.DOCKER_REPO }}/meme-service
docker run -d --rm --name server -p 8080:8080 ${{ secrets.DOCKER_REPO }}/meme-service
# Docker Compose 실행
sudo docker-compose up -d
sudo docker-compose logs -f
# sudo docker-compose up -d
# sudo docker-compose logs -f
# 사용하지 않는 Docker 이미지 정리
sudo docker image prune -f

0 comments on commit b71b285

Please sign in to comment.