50 lines
1.5 KiB
Docker
50 lines
1.5 KiB
Docker
FROM python:3.11-slim as requirements-stage
|
|
WORKDIR /tmp
|
|
RUN pip install poetry
|
|
COPY pyproject.toml ./poetry.lock* /tmp/
|
|
# https://python-poetry.org/docs/cli#export
|
|
RUN poetry self add poetry-plugin-export
|
|
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 \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - \
|
|
&& apt-get install -y nodejs
|
|
|
|
RUN npm install -g firebase-tools
|
|
|
|
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.
|
|
ENTRYPOINT ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "1", "--threads", "8", "--timeout", "0", "-k", "uvicorn.workers.UvicornWorker", "ielts_be:app"]
|