Я считаю, что большая часть документации должна легко работать с Сани c, если вы слегка измените Dockerfile
:
FROM python:3.7
WORKDIR /app
# By copying over requirements first, we make sure that Docker will cache
# our installed requirements rather than reinstall them on every build
COPY requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt
# Now copy in our code, and run it
COPY . /app
EXPOSE 8000
CMD ["python", "main.py"]
Затем в main.py
:
from sanic import Sanic
app = Sanic("MyApp")
# ...
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000)