update
This commit is contained in:
40
.gitlab-ci.yml
Normal file
40
.gitlab-ci.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
# tahapan
|
||||
stages:
|
||||
- cleaning
|
||||
- build_image
|
||||
- deploy
|
||||
|
||||
# build image on development server
|
||||
build_image:
|
||||
stage: build_image
|
||||
script:
|
||||
- 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
|
||||
environment:
|
||||
only:
|
||||
- dev
|
||||
tags:
|
||||
- runner-internal-his
|
||||
|
||||
# deploy to development server
|
||||
deploy_development:
|
||||
stage: deploy
|
||||
script:
|
||||
- docker stack deploy --compose-file compose.yml scheduler-app
|
||||
environment:
|
||||
only:
|
||||
- dev
|
||||
tags:
|
||||
- runner-internal-his
|
||||
|
||||
# deploy to development server
|
||||
cleaning_image_and_container:
|
||||
stage: cleaning
|
||||
script:
|
||||
- echo y | docker container prune
|
||||
- echo y | docker image prune -a
|
||||
environment:
|
||||
only:
|
||||
- dev
|
||||
tags:
|
||||
- runner-internal-his
|
||||
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
# Gunakan Node.js 22 sebagai base image
|
||||
FROM node:22-alpine
|
||||
|
||||
# Atur working directory
|
||||
WORKDIR /app/scheduler-app
|
||||
|
||||
# Salin file package.json dan package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Jalankan npm install untuk menginstall dependensi
|
||||
RUN npm install
|
||||
|
||||
# Salin seluruh kode aplikasi
|
||||
COPY . .
|
||||
|
||||
# Ekspos port aplikasi (ubah sesuai konfigurasi aplikasi Anda)
|
||||
EXPOSE 3000
|
||||
|
||||
# Perintah default untuk menjalankan aplikasi
|
||||
CMD ["node", "index.js"]
|
||||
14
compose.yml
Normal file
14
compose.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
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.01"
|
||||
memory: "50m"
|
||||
restart: always
|
||||
Reference in New Issue
Block a user