spawner/user-template-next/Dockerfile
2026-01-30 18:00:41 +01:00

31 lines
560 B
Docker

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
COPY . .
RUN npm run build
# Production stage - serve static files with nginx
FROM nginx:alpine
# Copy static export
COPY --from=builder /app/out /usr/share/nginx/html
# Nginx config for SPA
RUN echo 'server { \
listen 8080; \
root /usr/share/nginx/html; \
index index.html; \
location / { \
try_files $uri $uri/ /index.html; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]