dockerfile-onestage
This commit is contained in:
parent
446b15d012
commit
5f4ad9279c
14
Dockerfile
14
Dockerfile
|
@ -1,5 +1,5 @@
|
||||||
# Stage 1: Build stage
|
# Use a single stage
|
||||||
FROM python:slim AS builder
|
FROM python:slim
|
||||||
|
|
||||||
WORKDIR /app
|
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
|
# Install Python dependencies including redis with hiredis support
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
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 . .
|
COPY . .
|
||||||
|
|
||||||
RUN pip install redis[hiredis]
|
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD ["python", "main.py"]
|
CMD ["python", "main.py"]
|
Loading…
Reference in New Issue
Block a user