ci: add build automation
continuous-integration/drone/tag Build is failing Details

main 1.0.0-production.1
Supan Adit Pratama 2024-10-03 11:55:43 +00:00
parent 22ac2da7a1
commit 7ba2065e46
5 changed files with 70 additions and 0 deletions

25
.drone.yml Normal file
View File

@ -0,0 +1,25 @@
kind: pipeline
type: docker
name: build
steps:
- name: production-offline
image: plugins/docker
settings:
registry: registry.eigen.co.id
repo: registry.eigen.co.id/eigen/${DRONE_REPO_NAME}-production-offline
tags: ${DRONE_TAG}
build_args:
- env_target=env.production-offline
- release_version=${DRONE_TAG}
- name: production-online
image: plugins/docker
settings:
registry: registry.eigen.co.id
repo: registry.eigen.co.id/eigen/${DRONE_REPO_NAME}-production-online
tags: ${DRONE_TAG}
build_args:
- env_target=env.production-online
- release_version=${DRONE_TAG}
trigger:
ref:
- refs/tags/*-production.*

25
Dockerfile Normal file
View File

@ -0,0 +1,25 @@
FROM node:20-alpine as build
ARG env_target
ARG release_version
WORKDIR /app
COPY . /app/
COPY env/$env_target /app/.env
RUN echo -e "\n" >> /app/.env
RUN echo -e "APP_VERSION=${release_version}" >> /app/.env
RUN yarn install
RUN yarn build
FROM nginx:1.16.0-alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

3
env/env.production-online vendored Normal file
View File

@ -0,0 +1,3 @@
VITE_APP_MODE=production
VITE_BASE_API_URL=https://api.office.weplayground.id/api
VITE_BASE_API_REPORT_URL=https://api.office.weplayground.id/api

17
nginx/nginx.conf Normal file
View File

@ -0,0 +1,17 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}