-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (45 loc) · 1.4 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
40
41
42
43
44
45
46
47
48
49
name: Deploy to production
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
name: Docker image build
steps:
- uses: actions/checkout@v4
- name: Setup node and install dependencies
uses: actions/setup-node@v4
with:
node-version: "20.18.0"
- name: Login to docker hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/backoffice \
--build-arg VITE_BASE_URL=${{ secrets.VITE_BASE_URL }} .
- name: Push docker image to Docker Hub
run: docker push ${{ secrets.DOCKER_USERNAME }}/backoffice:latest
deploy:
needs: build
runs-on: ubuntu-latest
name: Deployment
steps:
- name: Deploy using SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: 22
script: |
cd backoffice;
git pull;
docker stop backoffice;
docker rm backoffice;
docker pull akmatoff/backoffice:latest;
docker run --restart always -d -p 4000:4000 --name backoffice akmatoff/backoffice:latest