12345678910111213141516171819202122232425262728293031 |
- # syntax=docker/dockerfile:1
- # FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8
- FROM tiangolo/uvicorn-gunicorn:python3.9
- WORKDIR /app
- # Install Poetry
- RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
- cd /usr/local/bin && \
- ln -s /opt/poetry/bin/poetry && \
- poetry config virtualenvs.create false
- # Copy poetry.lock* in case it doesn't exist in the repo
- COPY pyproject.toml poetry.lock* /app/
- # Allow installing dev dependencies to run tests
- ARG INSTALL_DEV=false
- RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi"
- COPY ./app /app/app
- RUN mkdir -p /app/ml_models
- ENV PYTHONPATH=/app
- EXPOSE 8002
- COPY .env_pro /app/.env
- ENV TZ=Asia/Shanghai
- CMD ["uvicorn", "app.main:app", "--log-level", "info", "--host", "0.0.0.0", "--port", "8002"]
|