42 lines
1.2 KiB
Docker
42 lines
1.2 KiB
Docker
FROM python:3.11-slim as requirements-stage
|
|
WORKDIR /tmp
|
|
RUN pip install poetry
|
|
COPY pyproject.toml ./poetry.lock* /tmp/
|
|
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
|
|
|
|
|
|
FROM python:3.11-slim
|
|
|
|
# Allow statements and log messages to immediately appear in the logs
|
|
ENV PYTHONUNBUFFERED True
|
|
|
|
# Copy local code to the container image.
|
|
ENV APP_HOME /app
|
|
WORKDIR $APP_HOME
|
|
|
|
COPY . ./
|
|
|
|
COPY --from=requirements-stage /tmp/requirements.txt /app/requirements.txt
|
|
|
|
RUN apt update && apt install -y \
|
|
ffmpeg \
|
|
poppler-utils \
|
|
texlive-latex-base \
|
|
texlive-fonts-recommended \
|
|
texlive-latex-extra \
|
|
texlive-xetex \
|
|
pandoc \
|
|
librsvg2-bin \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN pip install --no-cache-dir -r /app/requirements.txt
|
|
|
|
EXPOSE 8000
|
|
|
|
# Run the web service on container startup. Here we use the gunicorn
|
|
# webserver, with one worker process and 8 threads.
|
|
# For environments with multiple CPU cores, increase the number of workers
|
|
# to be equal to the cores available.
|
|
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
|
|
CMD exec uvicorn --bind 0.0.0.0:8000 --workers 1 --threads 8 --timeout 0 app.server:app
|