dockerfile-onestage

This commit is contained in:
Untone 2024-09-27 09:48:15 +03:00
parent 446b15d012
commit 5f4ad9279c

View File

@ -1,5 +1,5 @@
# Stage 1: Build stage
FROM python:slim AS builder
# Use a single stage
FROM python:slim
WORKDIR /app
@ -11,18 +11,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends gcc libffi-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"]