diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..619b177 --- /dev/null +++ b/.drone.yml @@ -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.* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1e5107f --- /dev/null +++ b/Dockerfile @@ -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;"] diff --git a/env/env.production b/env/env.production-offline similarity index 100% rename from env/env.production rename to env/env.production-offline diff --git a/env/env.production-online b/env/env.production-online new file mode 100644 index 0000000..4dbed92 --- /dev/null +++ b/env/env.production-online @@ -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 diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..84700b7 --- /dev/null +++ b/nginx/nginx.conf @@ -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; + } + +}