welcomecenterbot/Dockerfile

28 lines
809 B
Docker
Raw Normal View History

2024-09-26 20:58:11 +00:00
# Stage 1: Build stage
2024-09-26 21:42:33 +00:00
FROM python:slim AS builder
2024-01-06 11:25:35 +00:00
2023-09-11 20:04:53 +00:00
WORKDIR /app
2024-01-06 11:25:35 +00:00
2024-02-12 12:50:35 +00:00
COPY requirements.txt .
2024-01-06 11:25:35 +00:00
2024-09-27 06:32:25 +00:00
# Install system dependencies required for building Python packages
2024-09-26 21:42:03 +00:00
RUN apt-get update && apt-get install -y --no-install-recommends gcc libffi-dev libssl-dev
2024-09-27 06:32:25 +00:00
# Install Python dependencies including redis with hiredis support
2024-09-27 05:44:13 +00:00
RUN pip install --no-cache-dir -r requirements.txt
2024-09-26 20:58:11 +00:00
# Stage 2: Final stage
FROM python:slim
WORKDIR /app
2024-02-12 12:50:35 +00:00
2024-09-26 20:58:11 +00:00
# Copy only necessary files from the builder stage
2024-09-27 06:32:25 +00:00
COPY --from=builder /usr/local/lib/python/dist-packages /usr/local/lib/python/dist-packages
COPY --from=builder /usr/local/lib/python3/dist-packages /usr/local/lib/python3/dist-packages
2024-09-26 20:58:11 +00:00
COPY --from=builder /usr/local/lib/python3.*/dist-packages /usr/local/lib/python3.*/dist-packages
2024-09-27 06:32:25 +00:00
2024-02-12 12:50:35 +00:00
COPY . .
EXPOSE 8080
2024-09-26 20:58:11 +00:00
CMD ["python", "main.py"]