feat: add gitlab-ci

This commit is contained in:
hanif salafi 2024-03-28 09:25:28 +07:00
parent fa775d4f24
commit a9b46bdbd8
3 changed files with 55 additions and 1 deletions

30
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,30 @@
stages:
- build
- deploy
build-dev:
stage: build
when: on_success
only:
- dev-main
- dev-restructure
image: docker:stable
services:
- docker:dind
script:
- docker logout
- docker login -u $DEPLOY_USERNAME -p $DEPLOY_TOKEN registry.gitlab.com
- docker build -t registry.gitlab.com/hanifsalafi/web-humas-polri:dev .
- docker push registry.gitlab.com/hanifsalafi/web-humas-polri:dev
auto-deploy:
stage: deploy
when: on_success
only:
- dev-main
- dev-restructure
image: curlimages/curl:latest
services:
- docker:dind
script:
- curl --user cekmedsos:$JENKINS_PWD http://103.82.242.92:8080/job/autodeploy-humas/build?token=autodeployhumas

24
Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM node:21-alpine
ENV PORT 4000
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Installing dependencies
COPY package*.json /usr/src/app/
# RUN npm install --force
RUN npm install -g npm@latest
RUN npm install next --legacy-peer-deps
# Copying source files
COPY . /usr/src/app
# Building app
RUN npm run build
EXPOSE 4000
# Running the app
CMD "npm" "run" "start"

View File

@ -5,7 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"start": "next start -p 4000",
"lint": "next lint"
},
"dependencies": {