Add pre-built frontend Docker approach - workaround for Zscaler proxy
Corporate proxy (Zscaler) causes npm to fail inside Docker builds with 'Exit handler never called' error. This approach builds frontend on host where npm works, then copies pre-built dist/ into Docker image. New files: - Dockerfile.prebuilt: Single-stage build, copies frontend/dist - docker-compose.prebuilt.yml: Uses Dockerfile.prebuilt - .dockerignore.prebuilt: Allows frontend/dist to be included - start-docker-quick.sh: Quick restart without rebuild - DOCKER-PREBUILT-APPROACH.md: Documents workaround and comparison Benefits: - Builds in 2-3 minutes (not 15+) - Works behind corporate proxy - Simpler to debug - Faster iteration Trade-off: Requires npm on host, two-step build process For production: CI/CD builds frontend + image, pushes to registry
This commit is contained in:
47
Dockerfile.prebuilt
Normal file
47
Dockerfile.prebuilt
Normal file
@@ -0,0 +1,47 @@
|
||||
# Dockerfile for pre-built frontend
|
||||
# Use this when frontend/dist is already built on the host
|
||||
# Avoids npm issues with corporate proxy
|
||||
|
||||
FROM python:3.14-slim AS base
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
default-libmysqlclient-dev \
|
||||
pkg-config \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Python dependencies
|
||||
COPY requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt \
|
||||
&& pip install --no-cache-dir gunicorn gevent
|
||||
|
||||
# Copy application code
|
||||
COPY shopdb/ ./shopdb/
|
||||
COPY plugins/ ./plugins/
|
||||
COPY migrations/ ./migrations/
|
||||
COPY scripts/ ./scripts/
|
||||
COPY wsgi.py ./
|
||||
|
||||
# Copy pre-built frontend
|
||||
COPY frontend/dist ./frontend/dist
|
||||
|
||||
# Make scripts executable
|
||||
RUN chmod +x /app/scripts/docker-entrypoint.sh /app/scripts/bootstrap-plugins.sh
|
||||
|
||||
# Create instance directory
|
||||
RUN mkdir -p /app/instance
|
||||
|
||||
# Expose port
|
||||
EXPOSE 5001
|
||||
|
||||
# Set environment
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV FLASK_APP=shopdb
|
||||
|
||||
# Entrypoint runs migrations and starts gunicorn
|
||||
ENTRYPOINT ["/app/scripts/docker-entrypoint.sh"]
|
||||
Reference in New Issue
Block a user