Skip to content

Instantly share code, notes, and snippets.

@trohit
Last active July 6, 2023 02:35
Show Gist options
  • Save trohit/e2dc9c9a6eee557d34265371939113c1 to your computer and use it in GitHub Desktop.
Save trohit/e2dc9c9a6eee557d34265371939113c1 to your computer and use it in GitHub Desktop.
Base Dockerfile for FastAPI Projects
echo "> Building Docker image ...[${DOCKER_IMAGE}]"
docker build -t $DOCKER_IMAGE ./docker
dcmd="docker run $opt --rm \
$docker_option \
-v $current_path:/home \
-u $(id -u ${USER_NAME}):$(id -g ${USER_NAME}) \
-w /home \
-e PYTHONPATH=/usr/local/lib/python3.8/dist-packages \
--name $DOCKER_NAME \
-p $DOCKER_PORT:$DOCKER_PORT\
-p 80:80\
$DOCKER_IMAGE \
bash -c \"$cmd\""
# Run docker web
echo $dcmd
out=`eval "$dcmd 2>&1"` || echo "Failed to start docker. err: $out"
ARG registry=library
ARG base=ubuntu
ARG version=20.04
FROM $registry/$base:$version
RUN apt-get update && apt update -y && apt-get install -y\
python3\
wget\
python3-pip\
curl\
sendmail\
less\
bc\
vim\
libsasl2-dev\
python-dev\
libldap2-dev\
libssl-dev
ADD requirements.txt /home/
RUN pip3 install -r /home/requirements.txt
RUN pip3 install python-multipart sqlalchemy jinja2==3.0.3
RUN pip3 install telepot colorlog
RUN pip3 install pyopenssl python-multipart
RUN pip3 install authlib itsdangerous
WORKDIR /home
aiofiles==0.6.0
apipkg==1.5
asn1crypto==0.24.0
attrs==19.3.0
boto3==1.21.24
botocore==1.24.24
certifi==2020.6.20
cffi==1.14.1
chardet==3.0.4
click==7.1.2
configparser==5.0.0
cryptography==3.0
cycler==0.10.0
dateparser==1.0.0
DateTimeRange==1.0.0
defusedxml==0.6.0
dnspython==2.0.0
email-validator==1.1.2
execnet==1.7.1
fastapi==0.61.2
future==0.18.2
h11==0.11.0
idna==2.10
importlib-metadata==1.7.0
joblib==0.16.0
keyring==10.6.0
keyrings.alt==3.0
kiwisolver==1.3.1
matplotlib==3.4.3
mbstrdecoder==1.0.1
more-itertools==8.4.0
MarkupSafe==2.1.2
oauthlib==3.1.0
packaging==20.4
pandas==1.3.2
pbr==5.4.5
Pillow==8.3.1
pluggy==0.13.1
prettytable==0.7.2
py==1.9.0
pycparser==2.20
pycrypto==2.6.1
pydantic==1.7.2
PyJWT==1.7.1
pyparsing==2.4.7
pytest==6.1.0
pytest-cov==3.0.0
pytest-forked==1.3.0
pytest-html==2.1.1
pytest-metadata==1.10.0
pytest-xdist==1.33.0
python-dateutil==2.8.1
python-ldap==3.4.0
pytz==2021.1
pyxdg==0.25
regex==2021.4.4
requests==2.24.0
requests-oauthlib==1.3.0
requests-toolbelt==0.9.1
scipy==1.5.2
SecretStorage==2.3.1
six==1.15.0
starlette==0.13.6
threadpoolctl==2.1.0
typepy==1.1.4
typing-extensions==3.7.4.3
tzlocal==2.1
urllib3==1.25.10
uvicorn==0.12.3
virtualenv==15.1.0
wcwidth==0.2.5
zipp==3.1.0
qrcode==7.4.2
hypercorn==0.14.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment