diff options
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 46 |
1 files changed, 2 insertions, 44 deletions
@@ -1,53 +1,11 @@ -# Build stage FROM node:lts-alpine AS build - -# Set working directory WORKDIR /app - -# Copy package files COPY package*.json ./ - -# Install dependencies with npm ci for faster, reliable builds -RUN npm ci --only=production - -# Copy source code +RUN npm install COPY . . - -# Build the application RUN npm run build -# Runtime stage FROM nginx:alpine AS runtime - -# Install dumb-init for proper signal handling -RUN apk add --no-cache dumb-init - -# Copy nginx configuration COPY ./nginx/nginx.conf /etc/nginx/nginx.conf - -# Copy built application from build stage COPY --from=build /app/dist /usr/share/nginx/html - -# Set proper permissions -RUN 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 - -# Create nginx PID directory -RUN mkdir -p /var/run/nginx && \ - chown -R nginx:nginx /var/run/nginx - -# Switch to non-root user -USER nginx - -# Expose port -EXPOSE 8080 - -# Add health check -HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ - CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1 - -# Use dumb-init to handle signals properly -ENTRYPOINT ["dumb-init", "--"] -CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file +EXPOSE 8080
\ No newline at end of file |