Compare commits

10 Commits

Author SHA1 Message Date
61035bc431 update url
All checks were successful
Gitea Actions Demo / check (push) Successful in 22s
2024-09-30 18:23:10 +07:00
ab57d64006 update env
All checks were successful
Gitea Actions Demo / check (push) Successful in 24s
2024-09-30 18:13:12 +07:00
049164596c update url
All checks were successful
Gitea Actions Demo / check (push) Successful in 23s
2024-09-30 18:05:42 +07:00
bf275844d2 update for stg
All checks were successful
Gitea Actions Demo / check (push) Successful in 25s
2024-09-30 18:00:00 +07:00
4953cf09da update docker compose
All checks were successful
Gitea Actions Demo / check (push) Successful in 49s
2024-09-24 16:57:49 +07:00
ceb8276206 update docker compose
Some checks failed
Gitea Actions Demo / check (push) Failing after 3s
2024-09-24 16:56:52 +07:00
f496fd743c update runner
Some checks failed
Gitea Actions Demo / check (push) Failing after 4s
2024-09-24 16:53:31 +07:00
2e8f6329b5 Merge pull request 'create-docker' (#2) from create-docker into develop
Some checks failed
Gitea Actions Demo / check (push) Failing after 3s
Reviewed-on: #2
2024-09-24 09:48:42 +00:00
b2ae96a397 [FW-0] update runner 2024-09-24 16:47:30 +07:00
735f2790a8 Create docker file 2024-09-23 17:39:17 +08:00
8 changed files with 99 additions and 58 deletions

View File

@ -0,0 +1,21 @@
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
push:
branches: [develop]
jobs:
check:
runs-on: self-hosted
defaults:
run:
working-directory: /home/raysam/act-runner-host/repo
steps:
- run: git --version
- run: rm -rf fuware-fe
- run: git clone ssh://git@thamluu.synology.me:222/sam/fuware-fe.git fuware-fe
- name: run docker
working-directory: /home/raysam/act-runner-host/repo/fuware-fe
run: git switch develop && docker compose up --build -d
- run: echo "🍏 This job's status is ${{ job.status }}."

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ node_modules
dist dist
dist-ssr dist-ssr
*.local *.local
.env
# Editor directories and files # Editor directories and files
.vscode/* .vscode/*

View File

@ -1,14 +1,18 @@
FROM node:18.19.0-alpine3.19 FROM node:18.20.4-alpine3.20
WORKDIR /app/client WORKDIR /app
RUN npm install -g pnpm
COPY package*.json . COPY package*.json .
RUN npm i COPY pnpm-lock.yaml .
RUN pnpm install --prefer-offline=true --frozen-lockfile=true
RUN npm i -g serve
COPY . . COPY . .
ENV NODE_ENV=production ENV NODE_ENV=production
ENV VITE_LOGIN_KEY=7fo24CMyIc
EXPOSE 5000 RUN pnpm build
CMD ["npm", "run", "dev"] EXPOSE 3000
CMD [ "serve", "-s", "dist" ]

19
Dockerfile.dev Normal file
View File

@ -0,0 +1,19 @@
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=development
ENV VITE_BE_URL=https://stg-be.samliu.io.vn
RUN pnpm build
EXPOSE 3000
CMD [ "serve", "-s", "dist" ]

12
docker-compose.yml Normal file
View File

@ -0,0 +1,12 @@
services:
fuware:
container_name: fuware-fe
image: fuware-fe
build:
context: .
dockerfile: Dockerfile.dev
restart: always
ports:
- 16001:3000
environment:
NODE_ENV: 'production'

View File

@ -1,15 +1,19 @@
export const POST_LOGIN = '/api/auth/login' const BASE_URL = import.meta.env.VITE_BE_URL ?? ''
export const POST_LOGOUT = '/api/auth/logout'
export const POST_REFRESH = '/api/auth/refresh' console.log(BASE_URL)
export const GET_USER_PROFILE = '/api/user/me'
export const PUT_UPDATE_USER_PROFILE = '/api/user/update-profile' 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 * 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 }) => export const GET_HOUSES_LIST = ({ page, pageSize }) =>
`/api/house/all?page=${page}&pageSize=${pageSize}` `${BASE_URL}/api/house/all?page=${page}&pageSize=${pageSize}`
export const GET_HOUSE_DETAIL = (id) => `/api/house/${id}` export const GET_HOUSE_DETAIL = (id) => `${BASE_URL}/api/house/${id}`
export const PUT_UPDATE_HOUSE = '/api/house/update' export const PUT_UPDATE_HOUSE = `${BASE_URL}/api/house/update`
export const DEL_DELETE_HOUSE = (id) => `/api/house/delete/${id}` export const DEL_DELETE_HOUSE = (id) => `${BASE_URL}/api/house/delete/${id}`

View File

@ -24,7 +24,7 @@ export default function Home() {
const first = getFirstItem(NAV_ITEM(t, auth?.userInfo?.isAdmin)) const first = getFirstItem(NAV_ITEM(t, auth?.userInfo?.isAdmin))
navigate(first ? first.pathName : PathConstants.PROFILE) navigate(first ? first.pathName : PathConstants.PROFILE)
} }
}, [auth.userInfo.isAdmin]) }, [auth.userInfo?.isAdmin])
return <></> return <></>
} }

View File

@ -10,44 +10,7 @@ export default defineConfig(({ mode }) => {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const env = loadEnv(mode, process.cwd(), '') const env = loadEnv(mode, process.cwd(), '')
// production const config_sv = {
if (env.NODE_ENV === 'production') {
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";',
},
},
},
server: {
https: false,
host: false,
port: 5001,
strictPort: true,
watch: {
usePolling: true,
},
},
}
}
return {
resolve: { resolve: {
alias: { alias: {
'@': path.resolve(_dirname, './src'), '@': path.resolve(_dirname, './src'),
@ -70,6 +33,26 @@ export default defineConfig(({ mode }) => {
}, },
}, },
}, },
}
// production
if (env.NODE_ENV === 'production') {
return {
...config_sv,
server: {
https: false,
host: false,
port: 5001,
strictPort: true,
watch: {
usePolling: true,
},
},
}
}
return {
...config_sv,
server: { server: {
https: false, https: false,
host: true, host: true,
@ -78,9 +61,6 @@ export default defineConfig(({ mode }) => {
watch: { watch: {
usePolling: true, usePolling: true,
}, },
proxy: {
'/api': 'http://localhost:9000',
},
}, },
} }
}) })