Create docker file

This commit is contained in:
Tham Luu 2024-09-23 17:39:17 +08:00
parent 2842b3fc19
commit 735f2790a8
3 changed files with 25 additions and 7 deletions

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" ]

14
docker-compose.yml Normal file
View File

@ -0,0 +1,14 @@
services:
fuware:
container_name: fuware-fe
image: fuware-fe:dev
build:
context: ../
target: production
dockerfile: ./Dockerfile
restart: always
ports:
- 3000:3000
environment:
NODE_ENV: 'production'
VITE_LOGIN_KEY: '7fo24CMyIc'

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 <></>
} }