Feat/UI enhancement (#28) #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: sast link frontend | |
on: | |
push: | |
branches: ["master"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build Docker image | |
run: | | |
docker buildx build --platform linux/amd64 -t sast/sast-link-frontend --output type=docker,dest=sast-link-frontend.tar . | |
- name: Extract image | |
run: | | |
[ -d sast-link-frontend ] || mkdir sast-link-frontend | |
tar -xf sast-link-frontend.tar -C sast-link-frontend | |
- name: Copy Docker image to server | |
uses: easingthemes/ssh-deploy@main | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_KEY }} | |
REMOTE_PORT: ${{ secrets.PORT }} | |
ARGS: "-ravc -i --delete" | |
SOURCE: "./sast-link-frontend/" | |
REMOTE_HOST: ${{ secrets.HOST }} | |
REMOTE_USER: ${{ secrets.USERNAME }} | |
TARGET: /tmp/sast-link-frontend | |
SCRIPT_BEFORE: | | |
[ -d /tmp/sast-link-frontend ] || mkdir /tmp/sast-link-frontend | |
SCRIPT_AFTER: | | |
cd /tmp/sast-link-frontend | |
tar -cf sast-link-frontend.tar * | |
### Notice: run for develop ### | |
# Stop and remove existing container if it exists | |
if [ "$(docker ps -aq -f name=sast-link-frontend)" ]; then | |
docker stop sast-link-frontend | |
docker rm sast-link-frontend | |
fi | |
# Remove existing image if it exists | |
if [ "$(docker images -q sast/sast-link-frontend)" ]; then | |
docker rmi sast/sast-link-frontend | |
fi | |
docker load -i sast-link-frontend.tar | |
docker run --restart always -d --name sast-link-frontend -p 127.0.0.1:3000:3000 sast/sast-link-frontend |