arshenoy commited on
Commit
5169bc3
·
verified ·
1 Parent(s): b2da426

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -4
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- # --- Stage 1: Build ---
2
  FROM node:18-alpine as build
3
  WORKDIR /app
4
  COPY package*.json ./
@@ -6,12 +6,30 @@ RUN npm install
6
  COPY . .
7
  ARG VITE_API_KEY
8
  ENV VITE_API_KEY=$VITE_API_KEY
 
 
9
  RUN npm run build
10
 
11
- # --- Stage 2: Serve ---
12
  FROM nginx:alpine
13
  COPY --from=build /app/dist /usr/share/nginx/html
14
- # Copy a simple nginx config to handle React routing
15
- RUN echo 'server { listen 7860; location / { root /usr/share/nginx/html; index index.html; try_files $uri $uri/ /index.html; } }' > /etc/nginx/conf.d/default.conf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  EXPOSE 7860
17
  CMD ["nginx", "-g", "daemon off;"]
 
1
+ # Stage 1: Build
2
  FROM node:18-alpine as build
3
  WORKDIR /app
4
  COPY package*.json ./
 
6
  COPY . .
7
  ARG VITE_API_KEY
8
  ENV VITE_API_KEY=$VITE_API_KEY
9
+ ARG VITE_MEDIA_API_URL
10
+ ENV VITE_MEDIA_API_URL=$VITE_MEDIA_API_URL
11
  RUN npm run build
12
 
13
+ # Stage 2: Serve
14
  FROM nginx:alpine
15
  COPY --from=build /app/dist /usr/share/nginx/html
16
+
17
+ # FIX: Proper Nginx Config with MIME types to prevent black screen
18
+ RUN echo 'server { \
19
+ listen 7860; \
20
+ root /usr/share/nginx/html; \
21
+ index index.html; \
22
+ include /etc/nginx/mime.types; \
23
+ \
24
+ location / { \
25
+ try_files $uri $uri/ /index.html; \
26
+ } \
27
+ \
28
+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { \
29
+ expires 30d; \
30
+ add_header Cache-Control "public, no-transform"; \
31
+ } \
32
+ }' > /etc/nginx/conf.d/default.conf
33
+
34
  EXPOSE 7860
35
  CMD ["nginx", "-g", "daemon off;"]