Skip to content

Update BackEnd.yml #144

Update BackEnd.yml

Update BackEnd.yml #144

Workflow file for this run

# # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
# name: Node.js CI
# on:
# push:
# branches: ["BE/main"]
# jobs:
# build_docker:
# # needs: test
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# with:
# context: ./back
# push: true
# tags: ghcr.io/yunuo46/was_test:latest
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: yunuo46
# password: ${{ secrets.GHCR_TOKEN }}
# - name: Build and push
# uses: docker/build-push-action@v5
# with:
# context: ./back
# push: true
# tags: ghcr.io/yunuo46/was_test:latest
# deploy_docker:
# needs: build_docker
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: SSH Version Check
# run: ssh -V
# - name: Deploy to Server via SSH
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.SERVER_HOST }}
# username: ${{ secrets.SERVER_USERNAME }}
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# port: 22
# script: |
# ssh -i ~/.ssh/id_rsa [email protected] << 'EOF'
# echo "${{ secrets.ENV_FILE }}" > .env
# echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u yunuo46 --password-stdin
# docker pull ghcr.io/yunuo46/was_test:latest
# docker stop was_test || true
# docker rm was_test || true
# docker run -d --name was_test -p 3000:3000 --env-file .env ghcr.io/yunuo46/was_test:latest
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
branches: ["BE/main"]
jobs:
build_docker:
# needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
context: ./back
push: true
tags: ghcr.io/peageon/ssock:latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: peageon
password: ${{ secrets.GHCR_TOKEN_TEST }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./back
push: true
tags: ghcr.io/peageon/ssock:latest
deploy_docker:
needs: build_docker
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: SSH Version Check
run: ssh -V
- name: Deploy to Server via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
echo "${{ secrets.ENV_FILE }}" > .env
echo ${{ secrets.GHCR_TOKEN_TEST }} | docker login ghcr.io -u peageon --password-stdin
docker pull ghcr.io/peageon/ssock:latest
docker stop ssock || true
docker rm ssock || true
docker run -d --name ssock --restart always -p 3000:3000 --env-file .env --cpuset-cpus="0" ghcr.io/peageon/ssock:latest