Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

dockerfile for django project

FROM python:3.9-alpine3.13
LABEL mantainer="libcs.me"

ENV PYTHONBUFFERED 1
COPY ./requirements.txt /tmp/requirements.txt
COPY ./app /app
WORKDIR /app
EXPOSE 8000



RUN python -m venv /py && 
    /py/bin/pip install --upgrade pip && 
    /py/bin/pip install -r/tmp/requirements.txt && 
    rm -rf /tmp && 
    adduser 
    --disable-password 
    --no-create-home  
    django-user


ENV PATH="/py/bin:$PATH"

USER django-user
 
PREVIOUS NEXT
Tagged: #dockerfile #django #project
ADD COMMENT
Topic
Name
9+3 =