-
Notifications
You must be signed in to change notification settings - Fork 4
56 lines (43 loc) · 1.44 KB
/
prod-fe-docker.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
name: Build and Push Docker Image
on:
push:
branches:
- prod-fe
jobs:
build:
name: Build, Test, and Push Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies with Yarn
run: yarn install
- name: Build only backend package with Yarn
run: yarn build:fe
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
run: |
docker compose -f fe.build.yaml build --no-cache
docker compose -f fe.build.yaml push
env:
DOCKER_BUILDKIT: 1
- name: Execute deployment script on remote server
env:
SSH_PEM_KEY: ${{ secrets.SSH_PEM_KEY }}
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
SSH_PORT: ${{ secrets.SSH_PORT }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PEM_KEY" > ~/.ssh/SSH_PEM_KEY.pem
chmod 600 ~/.ssh/SSH_PEM_KEY.pem
ssh -p $SSH_PORT -i ~/.ssh/SSH_PEM_KEY.pem -o StrictHostKeyChecking=no [email protected] 'cd prod && bash prod_fe.sh'