-
Notifications
You must be signed in to change notification settings - Fork 2
39 lines (33 loc) · 1.16 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Deploy to AWS
on:
push:
branches:
- dev
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Docker
uses: actions/setup-docker@v2
with:
dockerfile: ../../resq/backend/resq/Dockerfile.remote
- name: Build and Push Docker Image
run: |
docker build -t resq:latest -f ../../resq/backend/resq/Dockerfile.remote ../../resq/backend/resq/
docker login -u alitpc2525 -p ${{ secrets.DOCKER_PASSWORD }}
docker tag resq:latest alitpc2525/resq:latest
docker push alitpc2525/resq:latest
- name: SSH into AWS EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_EC2_HOST }}
username: ec2-user
key: ${{ secrets.AWS_PRIVATE_KEY }}
script: |
sudo service docker start
sudo docker rm -f $(sudo docker ps -q)
sudo docker pull alitpc2525/resq:latest
sudo docker run -d -p 443:8081 -v /home/ec2-user/certbot/keystore.p12:/app/keystore.p12 alitpc2525/resq:latest
sudo docker ps