Merge branch 'main' into develop

This commit is contained in:
Warunee Tamkoo 2025-06-23 17:58:07 +07:00
commit a474ed9221
3 changed files with 112 additions and 10 deletions

102
.onedev-buildspec.yml Normal file
View file

@ -0,0 +1,102 @@
version: 38
jobs:
- name: CI for UAT
steps:
- !CheckoutStep
name: checkout code
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !GenerateChecksumStep
name: generate package checksum
files: package-lock.json yarn.lock
targetFile: checksum
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetupCacheStep
name: set up npm cache
key: node_modules_@file:checksum@
loadKeys:
- node_modules
paths:
- node_modules
uploadStrategy: UPLOAD_IF_NOT_HIT
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetBuildVersionStep
name: set build version
buildVersion: '@tag@'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: build & test
runInContainer: true
image: node
interpreter: !DefaultInterpreter
commands: |
npm install
npm run build
useTTY: true
condition: NEVER
- !BuildImageStep
name: build docker image
dockerfile: ./cms/docker/Dockerfile
output: !RegistryOutput
tags: '@server@/bma-hrms/hrms-exam:@build_version@ @server@/bma-hrms/hrms-exam:latest'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !TagCreateTrigger
tags: uat-*
branches: main
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 14400
- name: CI for PROD
steps:
- !CheckoutStep
name: checkout code
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !GenerateChecksumStep
name: generate package checksum
files: package-lock.json yarn.lock
targetFile: checksum
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetupCacheStep
name: set up npm cache
key: node_modules_@file:checksum@
loadKeys:
- node_modules
paths:
- node_modules
uploadStrategy: UPLOAD_IF_NOT_HIT
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetBuildVersionStep
name: set build version
buildVersion: '@tag@'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: build & test
runInContainer: true
image: node
interpreter: !DefaultInterpreter
commands: |
npm install
npm run build
useTTY: true
condition: NEVER
- !BuildImageStep
name: build docker image
dockerfile: ./cms/docker/Dockerfile
output: !RegistryOutput
tags: '@server@/bma-hrms/hrms-exam:@build_version@ @server@/bma-hrms/hrms-exam:latest'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !TagCreateTrigger
tags: prod-*
branches: main
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 14400

View file

@ -1,17 +1,17 @@
# docker build . -t docker.frappet.com/demo/qualifying-exam-cms:latest
FROM node:20-alpine as build-stage
FROM node:20-alpine AS build-stage
WORKDIR /app
# optimize build speed by copy all .xx folder and
COPY *.json .
COPY *.*s .
COPY cms/*.json .
COPY cms/*.*s .
RUN npm i
COPY static ./static
COPY src ./src
# RUN ls
COPY cms/static ./static
COPY cms/src ./src
RUN npm run build
FROM node:lts-alpine
FROM node:lts-alpine AS production-stage
WORKDIR /app
COPY --from=build /app .
COPY --from=build-stage /app .
EXPOSE 80
ENV PORT=80
CMD ["node", "./build/index.js"]
CMD ["node", "./build/index.js"]

View file

@ -135,7 +135,7 @@
{#each data.positionsFalse as a}
<div class="text-lg py-1">
<div class="flex flex-wrap items-center">
{data.canRegister}
<!-- {data.canRegister} -->
{#if 'register_endDate' in data && data.canRegister}
<a
class="btn btn-sm btn-outline btn-info cursor-pointe"