Files
encoach_backend/Dockerfile
Carlos Mesquita 3cf9fa5cba Async release
2024-07-23 08:40:35 +01:00

38 lines
1.1 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
RUN pip install openai-whisper
# openai-whisper model in not compatible with the newer 2.0.0 numpy release
RUN pip install --upgrade numpy<2
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