2021-10-18 17:22:37 +00:00
|
|
|
FROM python:3.9.7-bullseye
|
|
|
|
LABEL maintainer="Stefano Pigozzi <me@steffo.eu>"
|
|
|
|
|
|
|
|
# Set the base workdir as seen in https://hub.docker.com/_/python/
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
# Install Poetry
|
|
|
|
RUN pip install 'poetry==1.1.11'
|
|
|
|
|
|
|
|
# Copy the environment requirements into the docker image
|
|
|
|
COPY pyproject.toml ./pyproject.toml
|
|
|
|
COPY poetry.lock ./poetry.lock
|
|
|
|
|
|
|
|
# Install the dependencies using Poetry
|
|
|
|
RUN poetry install --no-root
|
|
|
|
|
|
|
|
# Copy the rest of the project into the container
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# Install the project using Poetry
|
|
|
|
RUN poetry install
|
|
|
|
|
|
|
|
# Disable buffering as it may cause problems in logs
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
# Tell Django where the settings module is
|
|
|
|
ENV DJANGO_SETTINGS_MODULE="sophon.settings"
|
|
|
|
|
2021-10-18 20:01:51 +00:00
|
|
|
# Store the DBM file in a nice place
|
2021-10-19 18:15:29 +00:00
|
|
|
ENV DJANGO_PROXY_FILE="/run/sophon/proxy/proxy.dbm"
|
2021-10-18 20:01:51 +00:00
|
|
|
|
2021-10-18 22:20:56 +00:00
|
|
|
# Set the static files directory
|
2021-10-19 18:15:29 +00:00
|
|
|
ENV DJANGO_STATIC_ROOT="/run/sophon/static"
|
2021-10-18 22:20:56 +00:00
|
|
|
|
2021-10-18 17:22:37 +00:00
|
|
|
# Start the uvicorn server
|
2021-10-18 22:20:56 +00:00
|
|
|
ENTRYPOINT ["bash", "./docker_start.sh"]
|