alainivars/drf-microservice

View on GitHub
Dockerfile.drf-ms-sqlite.wodc

Summary

Maintainability
Test Coverage
# The doc: https://docs.docker.com/engine/reference/builder/#usage
# Dockerfile-drf-microservice
# Help from: https://www.eidel.io/2017/07/10/dockerizing-django-uwsgi-postgres/

FROM python:3.11.0b1

# The environment variable ensures that the python output is set straight
# to the terminal with out buffering it first
ENV PYTHONUNBUFFERED 1

# create root directory for our project in the container
RUN mkdir /drf-microservice

# Set the working directory to /drf-microservice
WORKDIR /drf-microservice

# Copy the current directory contents into the container at /drf-microservice
ADD . /drf-microservice/

# Install any needed packages specified in requirements.txt
RUN pip install -r requirements/docker-base.txt

RUN export DJANGO_SECRET_KEY=local; export DJANGO_SETTINGS_MODULE=my_api.settings.local; python manage.py makemigrations && python manage.py migrate

EXPOSE 8000

# with uwsgi:
# CMD ["uwsgi", "--ini", "/opt/drf-microservice/uwsgi.ini"]
# or direct:
CMD export DJANGO_SECRET_KEY=local; export DJANGO_SETTINGS_MODULE=my_api.settings.local; python3 manage.py runserver 0.0.0.0:8000