first
This commit is contained in:
44
.gitea/workflows/ci.yml
Normal file
44
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
name: Build and Deploy Scheduler
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: localhost:9999
|
||||||
|
IMAGE_NAME: ${{ secrets.PROJECT_NAME }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cleaning:
|
||||||
|
runs-on: host
|
||||||
|
steps:
|
||||||
|
- name: Cleanup docker
|
||||||
|
run: |
|
||||||
|
docker container prune -f
|
||||||
|
docker image prune -af
|
||||||
|
|
||||||
|
build_image:
|
||||||
|
runs-on: host
|
||||||
|
needs: cleaning
|
||||||
|
steps:
|
||||||
|
- name: Clone repo
|
||||||
|
run: |
|
||||||
|
git clone ${{ gitea.server_url }}/${{ gitea.repository }} .
|
||||||
|
git checkout ${{ gitea.ref_name }}
|
||||||
|
|
||||||
|
- name: Build image
|
||||||
|
run: |
|
||||||
|
docker build -t $REGISTRY/$IMAGE_NAME:${{ gitea.run_number }} .
|
||||||
|
|
||||||
|
- name: Push image
|
||||||
|
run: |
|
||||||
|
docker push $REGISTRY/$IMAGE_NAME:${{ gitea.run_number }}
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
runs-on: host
|
||||||
|
needs: build_image
|
||||||
|
steps:
|
||||||
|
- name: Deploy stack
|
||||||
|
run: |
|
||||||
|
docker compose up -d
|
||||||
14
compose.yml
14
compose.yml
@@ -1,14 +0,0 @@
|
|||||||
services:
|
|
||||||
app:
|
|
||||||
image: localhost:9999/$PROJECT_NAME:$CI_PIPELINE_ID
|
|
||||||
deploy:
|
|
||||||
replicas: 1
|
|
||||||
restart_policy:
|
|
||||||
condition: on-failure
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: "0.01"
|
|
||||||
memory: "50m"
|
|
||||||
restart: always
|
|
||||||
volumes:
|
|
||||||
- /home/script:/home/script
|
|
||||||
14
docker-compose.yaml
Normal file
14
docker-compose.yaml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: localhost:9999/${PROJECT_NAME}:${CI_PIPELINE_ID}
|
||||||
|
container_name: scheduler-app
|
||||||
|
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
deploy: {} # optional (ignored by compose, boleh hapus)
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- /home/script:/home/script
|
||||||
|
|
||||||
|
mem_limit: 50m
|
||||||
|
cpus: 0.01
|
||||||
Reference in New Issue
Block a user