File size: 840 Bytes
5169bc3
2088e03
 
 
 
 
 
 
5169bc3
 
2088e03
db6d1db
5169bc3
2088e03
 
5169bc3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2088e03
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Stage 1: Build
FROM node:18-alpine as build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
ARG VITE_API_KEY
ENV VITE_API_KEY=$VITE_API_KEY
ARG VITE_MEDIA_API_URL
ENV VITE_MEDIA_API_URL=$VITE_MEDIA_API_URL
RUN npm run build

# Stage 2: Serve
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html

# FIX: Proper Nginx Config with MIME types to prevent black screen
RUN echo 'server { \
    listen 7860; \
    root /usr/share/nginx/html; \
    index index.html; \
    include /etc/nginx/mime.types; \
    \
    location / { \
        try_files $uri $uri/ /index.html; \
    } \
    \
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { \
        expires 30d; \
        add_header Cache-Control "public, no-transform"; \
    } \
}' > /etc/nginx/conf.d/default.conf

EXPOSE 7860
CMD ["nginx", "-g", "daemon off;"]