mirror of
https://github.com/fastapi-practices/fastapi_best_architecture.git
synced 2025-08-26 04:33:09 +08:00
Replace APScheduler to Celery asynchronous tasks (#229)
* Replace APScheduler to Celery task * black format * Add celery to run the script * Update celery usage to README * Update test task * Add celery rabbitmq broker * Fix dockerfiles * Add task interface access authorization * Update celery deploy run * Fix dockerfiles * Fix supervisor conf * Update celery broker default is redis * Force the pro env to use rabbitmq * Update the task interface * Add celery beat README description * Update warning text style * Revoke the default config comment content of the supervisor
This commit is contained in:
26
backend.dockerfile
Normal file
26
backend.dockerfile
Normal file
@ -0,0 +1,26 @@
|
||||
FROM python:3.10-slim
|
||||
|
||||
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
|
||||
RUN pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple \
|
||||
&& pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
|
||||
|
||||
ENV TZ = Asia/Shanghai
|
||||
|
||||
RUN mkdir -p /var/log/fastapi_server
|
||||
|
||||
COPY ./deploy/fastapi_server.conf /etc/supervisor/conf.d/
|
||||
|
||||
EXPOSE 8001
|
||||
|
||||
CMD ["uvicorn", "backend.app.main:app", "--host", "127.0.0.1", "--port", "8000"]
|
Reference in New Issue
Block a user