-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (61 loc) · 2.06 KB
/
hispmd-build-and-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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Docker Build and Deploy
on:
push:
branches:
- main
jobs:
build:
name: Build and Push Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
submodules: true # Ensure submodules are checked out
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log into Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker Image
run: |
docker build --file Dockerfile --tag mikeintosh/mikeintosh-hispmd-app:latest .
- name: Push Docker Image
run: |
docker push mikeintosh/mikeintosh-hispmd-app:latest
deploy:
name: Deploy Docker Container
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
submodules: true # Ensure submodules are checked out
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Log into Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy Docker Container
run: |
docker-compose pull && docker-compose up -d
# Uncomment the following step to deploy automatically to your server
#- name: SSH into Server and Pull Docker Image
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.SERVER_HOST }}
# username: ${{ secrets.SERVER_USERNAME }}
# key: ${{ secrets.SERVER_SSH_PRIVATE_KEY }}
# script: |
# cd /path/to/project
# docker-compose pull
# docker-compose up -d