39 lines
785 B
Docker
39 lines
785 B
Docker
FROM ubuntu:22.04
|
|
|
|
WORKDIR /app
|
|
|
|
# Prevent interactive prompts
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Install Python 3.10 and dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
python3.10 \
|
|
python3-pip \
|
|
gcc \
|
|
libmysqlclient-dev \
|
|
pkg-config \
|
|
libssl-dev \
|
|
libffi-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create symlinks
|
|
RUN ln -sf /usr/bin/python3.10 /usr/bin/python && \
|
|
ln -sf /usr/bin/pip3 /usr/bin/pip
|
|
|
|
# Copy requirements and install
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy app code
|
|
COPY . .
|
|
|
|
# Production environment
|
|
ENV FLASK_ENV=production
|
|
ENV FLASK_APP=run.py
|
|
ENV FLASK_RUN_HOST=0.0.0.0
|
|
ENV FLASK_RUN_PORT=5000
|
|
|
|
EXPOSE 5000
|
|
|
|
# Use Gunicorn
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "run:app"] |