-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (32 loc) · 1.04 KB
/
vtmunc-runner.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
name: Production
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Login to docker hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Build docker image
run: docker build -t vtmunc/vtmunc .
- name: Publish images to docker hub
run: docker push vtmunc/vtmunc:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Create SSH key
run: |
echo "${{ secrets.EC2_IDENTITY_FILE}}" > vtmunc.pem
ssh-keyscan -H vtmunc.org -i vtmunc.pem > ~/.ssh/known_hosts
- name: SSH into EC2 instance
run: ssh -i vtmunc.pem webapp@vtmunc.org
- name: Pull image from docker hub
run: docker pull vtmunc/vtmunc:latest
- name: Delete old container
run: docker rm -rf vtmunc
- name: Run docker container
run: docker run -d -p 8080:8080 --name vtmunc vtmunc/vtmunc