Skip to content

Commit

Permalink
create docker file for frontend
Browse files Browse the repository at this point in the history
Signed-off-by: amitamrutiya2210 <amitamrutiya2210@gmail.com>
  • Loading branch information
amitamrutiya committed Feb 6, 2024
1 parent 3add17b commit 61c6637
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
1 change: 0 additions & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ pnpm-debug.log*
lerna-debug.log*

node_modules
package-lock.json
.env
dist
dist-ssr
Expand Down
17 changes: 17 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="./public/favicon.ico" />
<link rel="icon" type="image/svg+xml" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>StudyNotion</title>
</head>
Expand Down
1 change: 0 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
24 changes: 17 additions & 7 deletions frontend/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
},
},
},
},
})
});

0 comments on commit 61c6637

Please sign in to comment.