- Add Dockerfile with multi-stage build for production deployment - Add docker-compose.yml for easy local development - Add .dockerignore to optimize Docker build context - Update README with Docker and local setup instructions
34 lines
747 B
Docker
34 lines
747 B
Docker
# Use Python 3.11 slim image as base
|
|
FROM python:3.11-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
FLASK_APP=src/run.py
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements first for better layer caching
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Create necessary directories for runtime
|
|
RUN mkdir -p src/app/static/images src/app/static/barcodes src/app/instance
|
|
|
|
# Expose port 5555
|
|
EXPOSE 5555
|
|
|
|
# Run the application
|
|
CMD ["python", "src/run.py"]
|