update
This commit is contained in:
51
.gitea/workflows/ci.yaml
Normal file
51
.gitea/workflows/ci.yaml
Normal 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 }}
|
||||
Reference in New Issue
Block a user