Snippets: Docker: Dockerfile for Python

20th August 2020 at 2:19pm
Snippets: Docker
FROM python:3-slim
RUN sed -i 's/deb.debian.org/mirrors.cloud.tencent.com/g' /etc/apt/sources.list && sed -i 's/security.debian.org/mirrors.cloud.tencent.com/g' /etc/apt/sources.list
RUN apt-get update && apt-get install -y --no-install-recommends build-essential && apt-get autoclean

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.cloud.tencent.com/pypi/simple

RUN mkdir /app
COPY manage.py /app
COPY detail /app/detail
COPY app /app/app

WORKDIR /app
CMD python manage.py runserver 0.0.0.0:9080