-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (30 loc) · 987 Bytes
/
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
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/app ./app
- name: Publish images to docker hub
run: docker push vtmunc/app:latest
deploy:
runs-on: self-hosted
needs: build
steps:
- name: Login to docker hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Pull docker image
run: docker pull vtmunc/app:latest
- name: Remove old containers
run: docker rm -f vtmunc || true
- name: Run container
run: docker run -p 8080:8080 -d --name vtmunc vtmunc/app
- name: Clean up (Removes old containers)
run: docker system prune -f