dockerfile-fix
This commit is contained in:
parent
086855e754
commit
ca11a92361
25
Dockerfile
25
Dockerfile
|
@ -1,17 +1,26 @@
|
||||||
|
# Stage 1: Build stage
|
||||||
|
FROM python:slim as builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
gcc \
|
||||||
|
libffi-dev \
|
||||||
|
libssl-dev \
|
||||||
|
&& pip install --no-cache-dir -r requirements.txt \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Stage 2: Final stage
|
||||||
FROM python:slim
|
FROM python:slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy just the requirements file first
|
# Copy only necessary files from the builder stage
|
||||||
COPY requirements.txt .
|
COPY --from=builder /usr/local/lib/python3.*/dist-packages /usr/local/lib/python3.*/dist-packages
|
||||||
|
|
||||||
# Install requirements
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
# Copy the rest of the application code
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
# Set the entry point
|
|
||||||
CMD ["python", "main.py"]
|
CMD ["python", "main.py"]
|
Loading…
Reference in New Issue
Block a user