Fastapi: deploy: tiangolo/uvicorn-gunicorn-fastapi:python3.7 adding mysql

Created on 7 Jul 2020  路  2Comments  路  Source: tiangolo/fastapi

I have a question for deployment with docker and tiangolo/uvicorn-gunicorn-fastapi:python3.7 container ... my app uses sqlalchemy and mysql, installing sqlalchemy is possible by add pip3 install -r requirements.txt to the Dockerfile, but how to install the mysqlclient library for the underlying alpine? RUN apk add ... is not working ... apk not found, why not?

can someone help me please

why cant I use the apk command in the tiangolo/uvicorn-gunicorn-fastapi:python3.7 container ?

# docker build -t search_rest_api .

FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7

COPY ./app /app/app
RUN apk add mysqlclient
RUN pip3 install -r /app/app/requirements.txt

this docker file crashes at build because apk is not found ...

question

All 2 comments

The issue was closed, but if someone has this problem in the future: the tag used is based on Ubuntu instead of Alpine, you can check it following the flow of images used:

  1. https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker/blob/master/docker-images/python3.6-alpine3.8.dockerfile
  2. https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/docker-images/python3.8.dockerfile
  3. https://hub.docker.com/_/python

Thanks for the help here @Kludex ! :clap: :bow:

Thanks for closing the issue @Prutheus :+1:

Was this page helpful?
0 / 5 - 0 ratings