File size: 900 Bytes
803ded1
13ae717
803ded1
13ae717
 
93d579e
 
13ae717
93d579e
13ae717
93d579e
13ae717
 
a759fbd
40f42c0
a759fbd
40f42c0
 
d98e39c
 
 
93d579e
13ae717
 
40f42c0
 
86bd8df
13ae717
93d579e
40f42c0
021ab84
 
 
40f42c0
a759fbd
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
FROM node:20

# Ensure non-root user for build/run (node image has a non-root user with uid 1000)
USER 1000
WORKDIR /usr/src/app

# Install deps with ci for reproducibility and layer caching
COPY --chown=1000 package.json package-lock.json ./
RUN npm ci

# Copy the rest of the application
COPY --chown=1000 . .

# Normalize and ensure start script is executable
USER root
RUN sed -i 's/\r$//' /usr/src/app/start.sh && chmod +x /usr/src/app/start.sh
USER 1000

# Make embed/lite mode available at build-time for client code
ENV NEXT_PUBLIC_EMBED_MODE=true

# Build the app
RUN npm run build

# Expose both common ports (Space sets $PORT; we honor it at runtime)
EXPOSE 7860
EXPOSE 3000

ENV HOST=0.0.0.0
ENV PORT=7860
# Disable telemetry and ensure production env
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
# Start via script that logs and honors $PORT
ENTRYPOINT ["/usr/src/app/start.sh"]