Files
motovaultpro/frontend/Dockerfile
Eric Gullickson 8f5117a4e2 MVP Build
2025-08-09 12:47:15 -05:00

45 lines
967 B
Docker

# Production Dockerfile for MotoVaultPro Frontend
FROM node:20-alpine as build
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install production dependencies
RUN npm ci --only=production
# Copy source code
COPY . .
# Build the application
RUN npm run build
# Production stage with nginx
FROM nginx:alpine
# Copy built assets from build stage
COPY --from=build /app/dist /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
# Create non-root user for nginx
RUN addgroup -g 1001 -S nginx && \
adduser -S frontend -u 1001 -G nginx
# Change ownership of nginx directories
RUN chown -R frontend:nginx /var/cache/nginx && \
chown -R frontend:nginx /var/log/nginx && \
chown -R frontend:nginx /etc/nginx/conf.d
RUN touch /var/run/nginx.pid && \
chown -R frontend:nginx /var/run/nginx.pid
USER frontend
# Expose port
EXPOSE 3000
# Start nginx
CMD ["nginx", "-g", "daemon off;"]