Initial commit - Mold Cost Calculator Application (Security Fixed)

This commit is contained in:
Gan, Jimmy
2025-06-24 10:28:55 +08:00
commit 9b84cee5be
108 changed files with 15886 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
FROM python:3.11-slim AS builder
# Set working directory
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Final stage
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*
# Copy site-packages and binaries from builder
COPY --from=builder /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
COPY --from=builder /usr/local/bin/ /usr/local/bin/
# Create necessary directories
RUN mkdir -p /app/logs /app/instance && \
chmod -R 777 /app/logs /app/instance
# Copy application files
COPY . .
# Set environment variables
ENV FLASK_APP=run.py
ENV FLASK_ENV=production
# Expose port
EXPOSE 5002
# Run gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:5002", "--workers", "4", "app:create_app()"]