Compare commits

...

19 Commits

Author SHA1 Message Date
teddys48
e7c0596c03 update
All checks were successful
Build and Deploy / cleaning (push) Successful in 14s
Build and Deploy / build_image (push) Successful in 3m19s
Build and Deploy / deploy (push) Successful in 11s
2026-02-13 10:08:52 +07:00
teddys48
f4714e2e2a qwqw
All checks were successful
Build and Deploy / cleaning (push) Successful in 10s
Build and Deploy / build_image (push) Successful in 2m47s
Build and Deploy / deploy (push) Successful in 2s
2026-02-12 10:58:47 +07:00
teddys48
eb8cb1608e qwqw
All checks were successful
Build and Deploy / cleaning (push) Successful in 6s
Build and Deploy / build_image (push) Successful in 2m26s
Build and Deploy / deploy (push) Successful in 1s
2026-02-12 10:51:42 +07:00
teddys48
ce3dcd2aec update
All checks were successful
Build and Deploy / cleaning (push) Successful in 10s
Build and Deploy / build_image (push) Successful in 3m3s
Build and Deploy / deploy (push) Successful in 9s
2026-02-11 17:34:57 +07:00
teddys48
3cde6f7810 update
All checks were successful
Build and Deploy / cleaning (push) Successful in 6s
Build and Deploy / build_image (push) Successful in 2m53s
Build and Deploy / deploy (push) Successful in 1s
2026-02-11 12:12:20 +07:00
teddys48
cdd7730141 update
Some checks failed
Build and Deploy / cleaning (push) Successful in 1s
Build and Deploy / build_image (push) Failing after 0s
Build and Deploy / deploy (push) Has been skipped
2026-02-11 12:10:43 +07:00
teddys48
d109e04e63 update
Some checks failed
Build and Deploy / cleaning (push) Successful in 28s
Build and Deploy / build_image (push) Failing after 30s
Build and Deploy / deploy (push) Has been skipped
2026-02-11 12:02:37 +07:00
teddys48
1d194dacdc update
Some checks failed
Build and Deploy / cleaning (push) Failing after 0s
Build and Deploy / build_image (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped
2026-02-11 11:58:56 +07:00
teddys48
bcdf3cc9b1 update
Some checks failed
Build and Deploy / cleaning (push) Failing after 0s
Build and Deploy / build_image (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped
2026-02-11 11:56:42 +07:00
teddys48
265fddaa75 update
Some checks failed
Build and Deploy / cleaning (push) Failing after 5s
Build and Deploy / build_image (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped
2026-02-11 11:16:57 +07:00
teddys48
18dde9b423 update
Some checks failed
Build and Deploy / cleaning (push) Has been cancelled
Build and Deploy / build_image (push) Has been cancelled
Build and Deploy / deploy (push) Has been cancelled
2026-02-11 11:13:49 +07:00
teddys48
72f27ede55 update
Some checks failed
Build and Deploy / cleaning (push) Has been cancelled
Build and Deploy / build_image (push) Has been cancelled
Build and Deploy / deploy (push) Has been cancelled
2026-02-11 11:11:35 +07:00
teddys48
8afb048664 update
Some checks failed
Build and Deploy / build_and_deploy (push) Has been cancelled
2026-02-11 11:00:01 +07:00
teddys48
9794c1b212 update
Some checks failed
Build and Deploy / cleaning (push) Failing after 4s
Build and Deploy / build_image (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped
2026-02-11 10:55:56 +07:00
teddys48
e826cca9fc update
Some checks failed
Build and Deploy / cleaning (push) Failing after 3s
Build and Deploy / build_image (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped
2026-02-11 10:54:04 +07:00
teddys48
1047225b76 update
Some checks failed
Build and Deploy / cleaning (push) Failing after 5s
Build and Deploy / build_image (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped
2026-02-11 10:46:51 +07:00
teddys48
d9b92e3e6c update
Some checks failed
Build and Deploy / cleaning (push) Failing after 3s
Build and Deploy / build_image (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped
2026-02-11 10:40:24 +07:00
teddys48
666449e5c5 update
Some checks failed
Build and Deploy / cleaning (push) Failing after 1m35s
Build and Deploy / build_image (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped
2026-02-11 10:34:46 +07:00
teddys48
4065fa13ec 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
2026-02-11 10:32:43 +07:00
3 changed files with 57 additions and 2 deletions

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

@@ -0,0 +1,56 @@
name: Build and Deploy
on:
push:
branches:
- main
env:
REGISTRY: localhost:9999
IMAGE_NAME: ${{ secrets.PROJECT_NAME }}
jobs:
cleaning:
runs-on: host
container: null
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: host
needs: cleaning
steps:
- name: Clone repo
run: |
git clone ${{ gitea.server_url }}/${{ gitea.repository }} .
git checkout ${{ gitea.ref_name }}
- 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: host
needs: build_image
steps:
- name: Deploy container
run: |
docker run -d \
--name $IMAGE_NAME \
--memory="50m" \
--network scheduler-net \
--cpus="0.1" \
--restart always \
-p 9997:3000 \
$REGISTRY/$IMAGE_NAME:${{ gitea.run_number }}

View File

@@ -12,7 +12,7 @@ import (
func NewDatabase() *gorm.DB { func NewDatabase() *gorm.DB {
username := os.Getenv("DB_USERNAME") username := os.Getenv("DB_USERNAME")
password := "123$Nt1" password := os.Getenv("DB_PASSWORD")
port, err := strconv.Atoi(os.Getenv("DB_PORT")) port, err := strconv.Atoi(os.Getenv("DB_PORT"))
if err != nil { if err != nil {
fmt.Println("error ", err.Error()) fmt.Println("error ", err.Error())

View File

@@ -17,7 +17,6 @@ func corsMiddleware(next http.Handler) http.Handler {
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, FETCH") w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, FETCH")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization") w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
// Untuk preflight request
if r.Method == "OPTIONS" { if r.Method == "OPTIONS" {
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
return return