welcomecenterbot/Dockerfile
2024-09-27 09:46:48 +03:00

28 lines
655 B
Docker

# Stage 1: Build stage
FROM python:slim AS builder
WORKDIR /app
COPY requirements.txt .
# Install system dependencies required for building Python packages
RUN apt-get update && apt-get install -y --no-install-recommends gcc libffi-dev libssl-dev
# Install Python dependencies including redis with hiredis support
RUN pip install --no-cache-dir -r requirements.txt
# Stage 2: Final stage
FROM python:slim
WORKDIR /app
# Copy only necessary files from the builder stage
COPY --from=builder /usr/local/lib/python3.*/dist-packages /usr/local/lib/python3.*/dist-packages
COPY . .
RUN pip install redis[hiredis]
EXPOSE 8080
CMD ["python", "main.py"]