-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (36 loc) · 1.88 KB
/
Client-DEV-CD.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
name: Client-dev-CD
on:
push:
branches: ["main"]
paths: client/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.CLIENT_DOCKER_USERNAME }}
password: ${{ secrets.CLIENT_DOCKER_PASSWORD }}
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker Image
run: docker buildx build --platform linux/arm64,linux/amd64 -f Dockerfile --build-arg NEXT_PUBLIC_IMAGE_COMPRESS_URL=${{secrets.NEXT_PUBLIC_IMAGE_COMPRESS_URL}} --build-arg NEXT_PUBLIC_BASE_URL=${{secrets.NEXT_PUBLIC_BASE_URL}} --build-arg NEXT_PUBLIC_CLIENT_BASE_URL=${{secrets.NEXT_PUBLIC_CLIENT_BASE_URL}} --build-arg PORT=${{secrets.CLIENT_DEV_PORT}} -t ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_DEV_SERVICE_NAME }}:latest --push .
working-directory: ./client
- name: executing remote ssh commands using password
uses: appleboy/[email protected]
with:
host: ${{ secrets.STORYBOOK_CLOUD_HOST }}
username: ${{ secrets.CLOUD_USERNAME }}
password: ${{ secrets.STORYBOOK_CLOUD_PASSWORD }}
port: ${{ secrets.STORYBOOK_CLOUD_PORT }}
script: |
docker login -u ${{ secrets.CLIENT_DOCKER_USERNAME }} -p ${{ secrets.CLIENT_DOCKER_PASSWORD }}
docker pull ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_DEV_SERVICE_NAME }}:latest
docker rm -f ${{ secrets.CLIENT_DEV_SERVICE_NAME }}
docker run --name ${{ secrets.CLIENT_DEV_SERVICE_NAME }} -d -p ${{ secrets.CLIENT_DEV_PORT }}:${{ secrets.CLIENT_DEV_PORT }} ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_DEV_SERVICE_NAME }}:latest
docker image prune -f