File size: 1,136 Bytes
43024e4
 
 
 
 
dc345d7
43024e4
 
dc345d7
 
 
 
43024e4
dc345d7
 
 
 
43024e4
 
dc345d7
 
 
43024e4
dc345d7
 
43024e4
dc345d7
 
 
43024e4
 
dc345d7
 
 
 
 
 
 
 
43024e4
dc345d7
43024e4
 
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
36
37
38
39
40
41
42
43
44
FROM node:18-alpine AS builder

WORKDIR /app

# Install dependencies
COPY package.json package-lock.json ./
RUN npm ci --legacy-peer-deps

# Copy source
COPY public ./public
COPY src ./src
COPY tsconfig.json ./

# Build (warnings are ok, not errors)
ENV CI=false
ENV NODE_OPTIONS=--max_old_space_size=4096
ENV GENERATE_SOURCEMAP=false
RUN npm run build

# Confirm build succeeded
RUN test -f /app/build/index.html && echo "BUILD OK" || (echo "BUILD FAILED" && exit 1)
RUN ls -lah /app/build/static/js/ | head -5

# ── Serve with nginx ──
FROM nginx:1.25-alpine

RUN rm /etc/nginx/conf.d/default.conf

COPY --from=builder /app/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf

RUN mkdir -p /usr/share/nginx/html/assets /usr/share/nginx/html/outputs \
 && chmod -R 777 /usr/share/nginx/html \
 && chown -R nginx:nginx /usr/share/nginx/html \
 && chown -R nginx:nginx /var/cache/nginx \
 && chown -R nginx:nginx /var/log/nginx \
 && chown -R nginx:nginx /etc/nginx/conf.d \
 && touch /var/run/nginx.pid \
 && chown nginx:nginx /var/run/nginx.pid

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