Gurucool_Test / Dockerfile
ashwinR's picture
Update Dockerfile
b945c82
raw
history blame
885 Bytes
FROM python:3.9-slim AS builder
WORKDIR /app
COPY ./pyproject.toml .
COPY ./poetry.lock .
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential \
&& pip install --upgrade pip poetry \
&& poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi
FROM python:3.9-slim
WORKDIR /app
# Install runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends libpq5 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy the built virtual environment from the builder stage
COPY --from=builder /usr/local /usr/local
# Copy the rest of the backend files to the container
COPY ./ .
# Expose the backend port (change this if your FastAPI app uses a different port)
EXPOSE 7860
CMD ["gunicorn", "app:app", "-w", "4", "--bind", "0.0.0.0:7860"]