update for stg
All checks were successful
Gitea Actions Demo / check (push) Successful in 25s

This commit is contained in:
Sam Liu 2024-09-30 18:00:00 +07:00
parent 4953cf09da
commit bf275844d2
4 changed files with 70 additions and 49 deletions

18
Dockerfile.stg Normal file
View File

@ -0,0 +1,18 @@
FROM node:18.20.4-alpine3.20
WORKDIR /app
RUN npm install -g pnpm
COPY package*.json .
COPY pnpm-lock.yaml .
RUN pnpm install --prefer-offline=true --frozen-lockfile=true
RUN npm i -g serve
COPY . .
ENV NODE_ENV=stg
RUN pnpm build
EXPOSE 3000
CMD [ "serve", "-s", "dist" ]

View File

@ -4,7 +4,7 @@ services:
image: fuware-fe
build:
context: .
dockerfile: Dockerfile
dockerfile: Dockerfile.stg
restart: always
ports:
- 16001:3000

View File

@ -1,15 +1,17 @@
export const POST_LOGIN = '/api/auth/login'
export const POST_LOGOUT = '/api/auth/logout'
export const POST_REFRESH = '/api/auth/refresh'
export const GET_USER_PROFILE = '/api/user/me'
export const PUT_UPDATE_USER_PROFILE = '/api/user/update-profile'
const BASE_URL = ''
export const POST_LOGIN = `${BASE_URL}/api/auth/login`
export const POST_LOGOUT = `${BASE_URL}/api/auth/logout`
export const POST_REFRESH = `${BASE_URL}/api/auth/refresh`
export const GET_USER_PROFILE = `${BASE_URL}/api/user/me`
export const PUT_UPDATE_USER_PROFILE = `${BASE_URL}/api/user/update-profile`
/**
* House API
*/
export const POST_HOUSE_CREATE = '/api/house/create'
export const POST_HOUSE_CREATE = `${BASE_URL}/api/house/create`
export const GET_HOUSES_LIST = ({ page, pageSize }) =>
`/api/house/all?page=${page}&pageSize=${pageSize}`
export const GET_HOUSE_DETAIL = (id) => `/api/house/${id}`
export const PUT_UPDATE_HOUSE = '/api/house/update'
export const DEL_DELETE_HOUSE = (id) => `/api/house/delete/${id}`
`${BASE_URL}/api/house/all?page=${page}&pageSize=${pageSize}`
export const GET_HOUSE_DETAIL = (id) => `${BASE_URL}/api/house/${id}`
export const PUT_UPDATE_HOUSE = `${BASE_URL}/api/house/update`
export const DEL_DELETE_HOUSE = (id) => `${BASE_URL}/api/house/delete/${id}`

View File

@ -10,9 +10,7 @@ export default defineConfig(({ mode }) => {
// eslint-disable-next-line no-undef
const env = loadEnv(mode, process.cwd(), '')
// production
if (env.NODE_ENV === 'production') {
return {
const config_sv = {
resolve: {
alias: {
'@': path.resolve(_dirname, './src'),
@ -35,6 +33,12 @@ export default defineConfig(({ mode }) => {
},
},
},
}
// production
if (env.NODE_ENV === 'production') {
return {
...config_sv,
server: {
https: false,
host: false,
@ -47,29 +51,26 @@ export default defineConfig(({ mode }) => {
}
}
if (env.NODE_ENV === 'stg') {
return {
resolve: {
alias: {
'@': path.resolve(_dirname, './src'),
'@lang': path.resolve(_dirname, './src/lang'),
'@api': path.resolve(_dirname, './src/api'),
'@hooks': path.resolve(_dirname, './src/hooks'),
'@pages': path.resolve(_dirname, './src/pages'),
'@components': path.resolve(_dirname, './src/components'),
'@routes': path.resolve(_dirname, './src/routes'),
'@utils': path.resolve(_dirname, './src/utils'),
'@assets': path.resolve(_dirname, './src/assets'),
'@context': path.resolve(_dirname, './src/context'),
},
},
plugins: [react()],
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "./src/_mantine";',
},
...config_sv,
server: {
https: false,
host: false,
port: 5001,
strictPort: true,
watch: {
usePolling: true,
},
proxy: {
'/api': 'https://stg-be.samliu.io.vn',
},
},
}
}
return {
...config_sv,
server: {
https: false,
host: true,