New alert system and panel de control page
This commit is contained in:
@@ -9,15 +9,31 @@ WORKDIR /app
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies including dev dependencies for building
|
||||
# Install all dependencies for building
|
||||
RUN npm ci --verbose && \
|
||||
npm cache clean --force
|
||||
|
||||
# Copy source code
|
||||
# Copy source code (excluding unnecessary files like node_modules, dist, etc.)
|
||||
COPY . .
|
||||
|
||||
# Build the application for production
|
||||
# This will use environment variables available at build time
|
||||
# Create a default runtime config in the public directory if it doesn't exist to satisfy the reference in index.html
|
||||
RUN if [ ! -f public/runtime-config.js ]; then \
|
||||
mkdir -p public && \
|
||||
echo "window.__RUNTIME_CONFIG__ = {};" > public/runtime-config.js; \
|
||||
fi
|
||||
|
||||
# Set build-time environment variables to prevent hanging on undefined variables
|
||||
ENV NODE_ENV=production
|
||||
ENV CI=true
|
||||
ENV VITE_API_URL=/api
|
||||
ENV VITE_APP_TITLE="BakeWise"
|
||||
ENV VITE_APP_VERSION="1.0.0"
|
||||
ENV VITE_PILOT_MODE_ENABLED="false"
|
||||
ENV VITE_PILOT_COUPON_CODE="PILOT2025"
|
||||
ENV VITE_PILOT_TRIAL_MONTHS="3"
|
||||
ENV VITE_STRIPE_PUBLISHABLE_KEY="pk_test_"
|
||||
# Set Node.js memory limit for the build process
|
||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Production server with Nginx
|
||||
@@ -26,6 +42,9 @@ FROM nginx:1.25-alpine AS production
|
||||
# Install curl for health checks
|
||||
RUN apk add --no-cache curl
|
||||
|
||||
# Copy main nginx configuration that sets the PID file location
|
||||
COPY nginx-main.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Remove default nginx configuration
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
|
||||
@@ -49,18 +68,7 @@ RUN chown -R nginx:nginx /usr/share/nginx/html && \
|
||||
|
||||
# Create nginx PID directory and fix permissions
|
||||
RUN mkdir -p /var/run/nginx /var/lib/nginx/tmp && \
|
||||
chown -R nginx:nginx /var/run/nginx /var/lib/nginx
|
||||
|
||||
# Custom nginx.conf for running as non-root
|
||||
RUN echo 'pid /var/run/nginx/nginx.pid;' > /etc/nginx/nginx.conf && \
|
||||
echo 'events { worker_connections 1024; }' >> /etc/nginx/nginx.conf && \
|
||||
echo 'http {' >> /etc/nginx/nginx.conf && \
|
||||
echo ' include /etc/nginx/mime.types;' >> /etc/nginx/nginx.conf && \
|
||||
echo ' default_type application/octet-stream;' >> /etc/nginx/nginx.conf && \
|
||||
echo ' sendfile on;' >> /etc/nginx/nginx.conf && \
|
||||
echo ' keepalive_timeout 65;' >> /etc/nginx/nginx.conf && \
|
||||
echo ' include /etc/nginx/conf.d/*.conf;' >> /etc/nginx/nginx.conf && \
|
||||
echo '}' >> /etc/nginx/nginx.conf
|
||||
chown -R nginx:nginx /var/run/nginx /var/lib/nginx /etc/nginx
|
||||
|
||||
# Switch to non-root user
|
||||
USER nginx
|
||||
@@ -74,3 +82,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user