update
Some checks failed
Build and Deploy / cleaning (push) Failing after 1m47s
Build and Deploy / build_image (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped

This commit is contained in:
teddys48
2026-02-11 10:32:43 +07:00
parent 2996aefa8f
commit 4065fa13ec

51
.gitea/workflows/ci.yaml Normal file
View File

@@ -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 }}