mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-22 05:22:56 +00:00
* feat: add postgresql db supports * change: change mysql conn str create way * fix: Modify the default alembic migration file to meet multi-database support * Update settings and lint * update models * Simplify database config * Simplify the get db method * Update create db url * Updated model type adaptation * Update sql scripts * Fix models type * Adaptation to postgresql code generation * Update README.md * Fix alembic file template * Update docker scripts
29 lines
1.0 KiB
Docker
29 lines
1.0 KiB
Docker
FROM python:3.10-slim
|
|
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
WORKDIR /fba
|
|
|
|
COPY . .
|
|
|
|
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources \
|
|
&& sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list.d/debian.sources
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends gcc python3-dev \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
# 某些包可能存在同步不及时导致安装失败的情况,可更改为官方源:https://pypi.org/simple
|
|
&& pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple \
|
|
&& pip install -r backend/requirements.txt -i https://mirrors.aliyun.com/pypi/simple \
|
|
&& pip install gunicorn aio_pika supervisor wait-for-it -i https://mirrors.aliyun.com/pypi/simple
|
|
|
|
ENV TZ="Asia/Shanghai"
|
|
|
|
RUN mkdir -p /var/log/fastapi_server
|
|
|
|
COPY deploy/backend/fastapi_server.conf /etc/supervisor/conf.d/
|
|
|
|
EXPOSE 8001
|
|
|
|
CMD ["uvicorn", "backend.main:app", "--host", "127.0.0.1", "--port", "8000"]
|