Jade-Infra-test / Dockerfile
rushiljain's picture
Create Dockerfile
2660154 verified
Raw
History Blame Contribute Delete
661 Bytes
FROM node:18-alpine AS build
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --legacy-peer-deps
# Copy source code
COPY . .
# Build the app
RUN npm run build
# Production stage - serve with nginx
FROM nginx:alpine
# Copy built files to nginx
COPY --from=build /app/dist /usr/share/nginx/html
# Create nginx configuration for SPA routing
RUN echo 'server { \
listen 7860; \
server_name _; \
root /usr/share/nginx/html; \
index index.html; \
location / { \
try_files $uri $uri/ /index.html; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 7860
CMD ["nginx", "-g", "daemon off;"]