-
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
19 additions
and
4 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 |
---|---|---|
|
@@ -16,15 +16,29 @@ jobs: | |
|
||
- name: Build Docker image | ||
run: docker build . -f ./Dockerfile -t fivlao/sound:latest-dev | ||
|
||
- name: Save Docker image as tar file | ||
run: | | ||
docker save -o fivlao-sound.tar fivlao/sound:latest-dev | ||
chmod 664 fivlao-sound.tar | ||
touch file.txt | ||
pwd | ||
ls | ||
- name: Install AWS CLI | ||
run: | | ||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | ||
unzip awscliv2.zip | ||
sudo ./aws/install | ||
mkdir ./aws | ||
touch ./aws/config < ${{ secrets.AWS_CONFIG }} | ||
touch ./aws/credentials < ${{ secrets.AWS_CREDS }} | ||
- name: Start AWS EC2 instance | ||
run: | | ||
aws ec2 start-instances --instance-ids ${{ secrets.INSTANCE_ID }} | ||
sleep 60 | ||
- name: Transfer Docker image to remote server | ||
uses: appleboy/[email protected] | ||
with: | ||
|
@@ -42,7 +56,8 @@ jobs: | |
host: ${{ secrets.EC2_HOST }} | ||
script: | | ||
sudo docker load -i "/home/ubuntu/fivlao-sound.tar" | ||
rm /home/ubuntu/fivlao-sound.tar | ||
sudo docker stop prometei-rest-api || true | ||
sudo docker rm prometei-rest-api || true | ||
sudo docker run -d --name=prometei-rest-api -p 80:80 fivlao/sound:latest-dev | ||
- name: Stop AWS EC2 instance | ||
run: aws ec2 stop-instances --instance-ids ${{ secrets.INSTANCE_ID }} |