Created
September 28, 2023 02:31
-
-
Save BroHui/69c83b89edbcd22f28675fb8d5d714a5 to your computer and use it in GitHub Desktop.
Django 2.2 dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[uwsgi] | |
chdir = /var/www/demo | |
module = demo.wsgi | |
master = true | |
processes = 5 | |
socket = 0.0.0.0:8080 | |
http = 0.0.0.0:8081 | |
vacuum = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.7.9-slim-buster as base | |
WORKDIR /wheels | |
COPY ./requirements.txt . | |
RUN sed -i s@/deb.debian.org/@/mirrors.163.com/@g /etc/apt/sources.list \ | |
&& apt-get clean | |
RUN apt-get update && \ | |
apt-get install -y \ | |
default-libmysqlclient-dev \ | |
libmariadb3 \ | |
gcc | |
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \ | |
&& pip config set install.trusted-host pypi.tuna.tsinghua.edu.cn | |
RUN pip install -U pip \ | |
&& pip install --no-cache-dir wheel \ | |
&& pip wheel --no-cache-dir --wheel-dir=/wheels -r requirements.txt | |
FROM python:3.7.9-slim-buster | |
ENV PYTHONUNBUFFERED 1 | |
COPY --from=base /wheels /wheels | |
COPY --from=base /usr/lib/x86_64-linux-gnu/libmariadb.so.3 /usr/lib/x86_64-linux-gnu/ | |
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \ | |
&& pip config set install.trusted-host pypi.tuna.tsinghua.edu.cn | |
RUN pip install -U pip \ | |
&& pip install -f /wheels -r /wheels/requirements.txt \ | |
&& rm -rf /wheels \ | |
&& rm -rf /root/.cache/pip/* \ | |
WORKDIR /data | |
ENV UWSGI_INI="" | |
ENTRYPOINT ["sh", "-c", "uwsgi", "--ini", "$UWSGI_INI"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.7.9-slim-buster as base | |
WORKDIR /wheels | |
COPY ./requirements.txt . | |
RUN apt-get update && \ | |
apt-get install -y \ | |
default-libmysqlclient-dev \ | |
libmariadb3 \ | |
gcc | |
RUN pip install -U pip \ | |
&& pip install --no-cache-dir wheel \ | |
&& pip wheel --no-cache-dir --wheel-dir=/wheels -r requirements.txt | |
FROM python:3.7.9-slim-buster | |
ENV PYTHONUNBUFFERED 1 | |
COPY --from=base /wheels /wheels | |
COPY --from=base /usr/lib/x86_64-linux-gnu/libmariadb.so.3 /usr/lib/x86_64-linux-gnu/ | |
RUN pip install -U pip \ | |
&& pip install -f /wheels -r /wheels/requirements.txt \ | |
&& rm -rf /wheels \ | |
&& rm -rf /root/.cache/pip/* \ | |
WORKDIR /data | |
ENV UWSGI_INI="" | |
ENTRYPOINT ["sh", "-c", "uwsgi", "--ini", "$UWSGI_INI"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Django >=2.2.0, <2.3 | |
mysqlclient >= 2.0 | |
requests >= 2.11.1 | |
django-cors-headers >= 1.1.0 | |
redis >= 3.5.3 | |
uwsgi >= 2.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment