-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,15 +47,6 @@ jobs: | |
push: true | ||
tags: ${{ secrets.DK_USERNAME }}/${{ secrets.DK_IMAGE }}:latest | ||
|
||
- name: Send docker-compose.yml, .env to EC2 | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ubuntu | ||
key: ${{ secrets.EC2_KEY }} | ||
source: docker-compose.yml,.env | ||
target: /home/ubuntu | ||
|
||
- name: Deploy Docker to EC2 | ||
uses: appleboy/[email protected] | ||
with: | ||
|
@@ -64,10 +55,14 @@ jobs: | |
key: ${{ secrets.EC2_KEY }} | ||
script_stop: true | ||
script: | | ||
mv .env /tmp | ||
export $(cat /tmp/.env | xargs) | ||
sudo docker compose pull | ||
sudo docker compose up -d | ||
sudo docker pull mysql:8.1.0 | ||
sudo docker pull ${{ secrets.DK_USERNAME }}/${{ secrets.DK_IMAGE }}:latest | ||
sudo docker network create api-network | ||
sudo docker run --name ${DK_IMAGE}-db \ | ||
-e MYSQL_DATABASE=${DB_DATABASE} -e MYSQL_PASSWORD=${DB_PASSWORD} -e TZ=${TZ} \ | ||
-v mysql-data:/var/lib/mysql -p ${DB_PORT}:3306 -d mysql:8.1.0 --default-authentication-plugin=mysql_native_password | ||
sudo docker run --name ${DK_IMAGE} \ | ||
--link ${DK_IMAGE}-db:db -p ${PORT}:${PORT} -d ${DK_USERNAME}/${DK_IMAGE}:latest /home/bun/app/wait-for-db.sh | ||
sudo docker container prune -f | ||
sudo docker image prune -f | ||
rm -f docker-compose.yml /tmp/.env |