23 lines
534 B
Docker
23 lines
534 B
Docker
# 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
|
|
RUN pip install asyncio aiohttp redis[hiredis]
|
|
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 . .
|
|
|
|
EXPOSE 8080
|
|
|
|
CMD ["python", "main.py"] |