From 4065fa13ec4e537c65980f8fc4d0bc6b1bfff595 Mon Sep 17 00:00:00 2001 From: teddys48 Date: Wed, 11 Feb 2026 10:32:43 +0700 Subject: [PATCH] update --- .gitea/workflows/ci.yaml | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .gitea/workflows/ci.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..59f8250 --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,51 @@ +name: Build and Deploy + +on: + push: + branches: + - main + +env: + REGISTRY: localhost:9999 + IMAGE_NAME: ${{ secrets.PROJECT_NAME }} + +jobs: + cleaning: + runs-on: node + steps: + - name: Cleanup + run: | + docker stop $IMAGE_NAME || true + docker rm $IMAGE_NAME || true + docker container prune -f + docker image prune -af + + build_image: + runs-on: node + needs: cleaning + steps: + - uses: actions/checkout@v4 + + - name: Copy env + run: | + echo "${{ secrets.ENV_FILE }}" > .env + cat .env + + - name: Build & Push + run: | + docker build -t $REGISTRY/$IMAGE_NAME:${{ gitea.run_number }} . + docker push $REGISTRY/$IMAGE_NAME:${{ gitea.run_number }} + + deploy: + runs-on: node + needs: build_image + steps: + - name: Deploy container + run: | + docker run -d \ + --name $IMAGE_NAME \ + --memory="50m" \ + --cpus="0.1" \ + --restart always \ + -p 9997:3000 \ + $REGISTRY/$IMAGE_NAME:${{ gitea.run_number }}