Compare commits

...

29 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
teddy
2996aefa8f update 2025-06-04 14:40:55 +07:00
teddy
e61bd5160d update 2025-06-04 14:33:41 +07:00
teddy
7113c24817 update 2025-06-04 14:33:20 +07:00
teddy
bc75947f51 update tapngo validate out 2025-06-04 14:23:19 +07:00
teddy
ae676d80c5 update tapngo validate out 2025-06-04 14:18:27 +07:00
teddy
43270cbaa9 update 2025-06-04 14:13:30 +07:00
teddy
3ab6552290 update 2025-06-04 12:06:37 +07:00
teddy
0ed9b55801 update 2025-05-23 17:25:35 +07:00
teddy
7c40cad831 update 2025-05-23 17:14:33 +07:00
teddy
ba4ce4fca6 update 2025-05-23 17:10:24 +07:00
6 changed files with 78 additions and 18 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,8 +12,8 @@ build_image:
script:
- echo "Isi file .env:"
- cat .env
- docker build -t 36.66.3.44:7007/$PROJECT_NAME:$CI_PIPELINE_ID .
- docker push 36.66.3.44:7007/$PROJECT_NAME:$CI_PIPELINE_ID
- docker build -t 36.66.3.44:7007/$PROJECT_NAME:$CI_PIPELINE_IID .
- docker push 36.66.3.44:7007/$PROJECT_NAME:$CI_PIPELINE_IID
environment:
only:
- main
@@ -24,7 +24,7 @@ build_image:
deploy_development:
stage: deploy
script:
- docker stack deploy --compose-file compose.yml email-notification
- docker run -d --name $PROJECT_NAME --memory="50m" --cpus="0.1" --restart always -p 7010:3000 36.66.3.44:7007/$PROJECT_NAME:$CI_PIPELINE_IID
environment:
only:
- main
@@ -35,6 +35,8 @@ deploy_development:
cleaning_image_and_container:
stage: cleaning
script:
- docker stop $PROJECT_NAME || true
- docker rm $PROJECT_NAME || true
- echo y | docker container prune
- echo y | docker image prune -a
environment:

View File

@@ -9,6 +9,6 @@ RUN go mod download
RUN go build -o /email-notification
EXPOSE 3000
EXPOSE 3000
CMD [ "/email-notification" ]

View File

@@ -1,16 +1,19 @@
version: '3.8'
services:
app:
image: 36.66.3.44:7007/$PROJECT_NAME:$CI_PIPELINE_ID
deploy:
replicas : 1
restart_policy :
condition: on-failure
resources:
limits:
cpus: "0.1"
memory: "50m"
email-notification:
image: 36.66.3.44:7007/$PROJECT_NAME:$CI_PIPELINE_IID
# dns:
# - 8.8.8.8
# - 1.1.1.1
# deploy:
# replicas : 1
# restart_policy :
# condition: on-failure
# resources:
# limits:
# cpus: "0.1"
# memory: "50m"
restart: always
mem_limit: 50m
cpus: 0.1
ports:
- "7010:3000"

View File

@@ -12,7 +12,7 @@ import (
func NewDatabase() *gorm.DB {
username := os.Getenv("DB_USERNAME")
password := "123$Nt1"
password := os.Getenv("DB_PASSWORD")
port, err := strconv.Atoi(os.Getenv("DB_PORT"))
if err != nil {
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-Headers", "Content-Type, Authorization")
// Untuk preflight request
if r.Method == "OPTIONS" {
w.WriteHeader(http.StatusOK)
return