Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
saketh-05 committed Dec 16, 2024
1 parent bab407b commit 8e0434c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
13 changes: 4 additions & 9 deletions Frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Use the official Node.js 20 image
FROM node:18 as builder
FROM node:18-alphine AS builder

# Set the working directory
WORKDIR /usr/src/app
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./
Expand All @@ -15,17 +15,12 @@ COPY . .

RUN npm run build

# Expose port
FROM nginx:stable-alpine

# Copy built files from the builder stage
WORKDIR /usr/share/nginx/html
COPY --from=builder /app/dist /usr/share/nginx/html

RUN rm -rf *
COPY config/nginx.conf /etc/nginx/conf.d/default.conf

COPY --from=builder /usr/src/app/dist .

# Expose port 80 and start nginx
EXPOSE 80

ENTRYPOINT ["nginx", "-g", "daemon off;"]
8 changes: 0 additions & 8 deletions Frontend/README.md

This file was deleted.

24 changes: 24 additions & 0 deletions Frontend/config/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
server {
listen 80;
server_name localhost;

root /usr/share/nginx/html;
index index.html;

location / {
try_files $uri /index.html; # SPA fallback
}

location /assets/ {
expires 1y;
add_header Cache-Control "public";
}

error_page 404 /index.html;

# Optional: Compression for better performance
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_proxied any;
gzip_min_length 256;
}
3 changes: 2 additions & 1 deletion Frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"dev": "vite",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
"preview": "vite preview",
"serve": "vite preview"
},
"dependencies": {
"@emotion/react": "^11.13.5",
Expand Down
2 changes: 0 additions & 2 deletions Frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ function App() {
element={<LoginPage onLogin={toggleLogin} />}
/>
<Route path='/signup' element={<SignupPage />} />
<Route path='*' element={<NotFoundPage />} />
</>
)}
{!isLogin && <Route path='*' element={<Navigate to='/login' />} />}
{isLogin && <Route path='*' element={<Navigate to='/' />} />}
</Routes>
<BackgroundAudio />
</BrowserRouter>
Expand Down

0 comments on commit 8e0434c

Please sign in to comment.