feat: add gitlab-ci
This commit is contained in:
parent
fa775d4f24
commit
a9b46bdbd8
|
|
@ -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
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start -p 4000",
|
||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue