Initial
This commit is contained in:
56
Dockerfile
Normal file
56
Dockerfile
Normal file
@@ -0,0 +1,56 @@
|
||||
# Multi-stage build for React frontend and Python backend
|
||||
FROM node:18-alpine as frontend-builder
|
||||
|
||||
WORKDIR /app/frontend
|
||||
COPY ppq-frontend/package.json ppq-frontend/yarn.lock ./
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
COPY ppq-frontend/ ./
|
||||
RUN yarn build
|
||||
|
||||
# Python backend stage
|
||||
FROM python:3.13-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies for Pillow and HEIF support
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
libjpeg-dev \
|
||||
zlib1g-dev \
|
||||
libffi-dev \
|
||||
libheif-dev \
|
||||
pkg-config \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy Python dependencies and install
|
||||
COPY pyproject.toml ./
|
||||
RUN pip install --no-cache-dir -e .
|
||||
|
||||
# Install additional dependencies based on imports
|
||||
RUN pip install --no-cache-dir \
|
||||
flask==3.1.2 \
|
||||
flask-cors==6.0.1 \
|
||||
pillow==11.3.0 \
|
||||
pillow-heif==1.1.0 \
|
||||
werkzeug==3.1.3
|
||||
|
||||
# Copy Python application files
|
||||
COPY *.py ./
|
||||
COPY schemas/ ./schemas/
|
||||
|
||||
# Copy built React frontend from builder stage
|
||||
COPY --from=frontend-builder /app/frontend/dist ./ppq-frontend/dist
|
||||
|
||||
# Create uploads directory
|
||||
RUN mkdir -p uploads
|
||||
|
||||
# Expose port
|
||||
EXPOSE 5000
|
||||
|
||||
# Set environment variables
|
||||
ENV FLASK_APP=main.py
|
||||
ENV FLASK_ENV=production
|
||||
|
||||
# Run the application
|
||||
CMD ["python", "-m", "flask", "run", "--host=0.0.0.0", "--port=5000"]
|
||||
Reference in New Issue
Block a user