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
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy just the requirements file first
|
||||
COPY requirements.txt .
|
||||
|
||||
# Install requirements
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the rest of the application code
|
||||
# Copy only necessary files from the builder stage
|
||||
COPY --from=builder /usr/local/lib/python3.*/dist-packages /usr/local/lib/python3.*/dist-packages
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
# Set the entry point
|
||||
CMD ["python", "main.py"]
|
Loading…
Reference in New Issue
Block a user