39 lines
866 B
Docker
39 lines
866 B
Docker
# Stage 1: Build frontend
|
|
FROM node:22-slim AS frontend-build
|
|
WORKDIR /build
|
|
COPY frontend/package*.json ./
|
|
RUN npm ci
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: Production
|
|
FROM python:3.11-slim
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Python dependencies
|
|
COPY backend/requirements.txt ./
|
|
RUN pip install --no-cache-dir -r requirements.txt gunicorn
|
|
|
|
# Copy backend
|
|
COPY backend/ ./
|
|
|
|
# Copy frontend build
|
|
COPY --from=frontend-build /build/dist ./static
|
|
|
|
# Create data directory
|
|
RUN mkdir -p /app/data/files
|
|
|
|
# Environment
|
|
ENV FLASK_ENV=production
|
|
ENV DATABASE_PATH=/app/data/minicloud.db
|
|
ENV UPLOAD_PATH=/app/data/files
|
|
|
|
EXPOSE 5000
|
|
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "4", "--timeout", "120", "wsgi:application"]
|