From 61c6637d7170f196ac6021e8a901f2c3a2590387 Mon Sep 17 00:00:00 2001 From: amitamrutiya2210 Date: Tue, 6 Feb 2024 23:48:49 +0530 Subject: [PATCH] create docker file for frontend Signed-off-by: amitamrutiya2210 --- frontend/.gitignore | 1 - frontend/Dockerfile | 17 +++++++++++++++++ frontend/index.html | 2 +- frontend/package.json | 1 - frontend/vite.config.js | 24 +++++++++++++++++------- 5 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 frontend/Dockerfile diff --git a/frontend/.gitignore b/frontend/.gitignore index 2f4d051..a120b79 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -8,7 +8,6 @@ pnpm-debug.log* lerna-debug.log* node_modules -package-lock.json .env dist dist-ssr diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..6189859 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,17 @@ +# # Description: Dockerfile for the frontend + +FROM node:21 + +WORKDIR /app + +COPY package.json . + +RUN npm install + +COPY . . + +RUN npm run build + +EXPOSE 3000 + +CMD [ "npm", "run", "preview" ] \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html index 6cfd353..231c33e 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -3,7 +3,7 @@ - + StudyNotion diff --git a/frontend/package.json b/frontend/package.json index 72e4431..3a147ff 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -14,7 +14,6 @@ "dependencies": { "@ramonak/react-progress-bar": "^5.0.3", "@reduxjs/toolkit": "^1.9.7", - "axios": "^1.6.0", "chart.js": "^4.4.0", "copy-to-clipboard": "^3.3.3", "react": "^18.2.0", diff --git a/frontend/vite.config.js b/frontend/vite.config.js index c94f8a0..8d772e1 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -4,26 +4,36 @@ import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + preview: { + port: 3000, + strictPort: true, + }, + server: { + port: 3000, + strictPort: true, + host: true, + origin: "http://0.0.0.0:3000", + }, define: { global: {}, }, optimizeDeps: { - include: ['react-dom'], + include: ["react-dom"], }, build: { chunkSizeWarningLimit: 1600, rollupOptions: { output: { - manualChunks (id) { - if (id.includes('node_modules')) { + manualChunks(id) { + if (id.includes("node_modules")) { return id .toString() - .split('node_modules/')[1] - .split('/')[0] - .toString() + .split("node_modules/")[1] + .split("/")[0] + .toString(); } }, }, }, }, -}) +});