From 260b7db7656e310865e57eada12b106bd6e28624 Mon Sep 17 00:00:00 2001 From: pedro Date: Fri, 2 Aug 2024 13:05:02 +0200 Subject: [PATCH] add minimal docker support for debugging --- db/.gitignore | 6 +++ docker-compose.yml | 12 ++++++ docker/devicehub-django.Dockerfile | 35 +++++++++++++++++ docker/devicehub-django.entrypoint.sh | 56 +++++++++++++++++++++++++++ 4 files changed, 109 insertions(+) create mode 100644 db/.gitignore create mode 100644 docker-compose.yml create mode 100644 docker/devicehub-django.Dockerfile create mode 100644 docker/devicehub-django.entrypoint.sh diff --git a/db/.gitignore b/db/.gitignore new file mode 100644 index 0000000..2171e8d --- /dev/null +++ b/db/.gitignore @@ -0,0 +1,6 @@ +# src https://stackoverflow.com/questions/115983/how-do-i-add-an-empty-directory-to-a-git-repository + +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b6e2d01 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +services: + devicehub-django: + init: true + build: + dockerfile: docker/devicehub-django.Dockerfile + environment: + DEBUG: true + volumes: + - .:/opt/devicehub-django + ports: + - 8000:8000 + diff --git a/docker/devicehub-django.Dockerfile b/docker/devicehub-django.Dockerfile new file mode 100644 index 0000000..2f734b4 --- /dev/null +++ b/docker/devicehub-django.Dockerfile @@ -0,0 +1,35 @@ +FROM python:3.11.7-slim-bookworm + +# last line is dependencies for weasyprint (for generating pdfs in lafede pilot) https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#debian-11 +RUN apt update && \ + apt-get install -y \ + python3-xapian \ + git \ + sqlite3 \ + jq \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /opt/devicehub-django + +# reduce size (python specifics) -> src https://stackoverflow.com/questions/74616667/removing-pip-cache-after-installing-dependencies-in-docker-image +ENV PYTHONDONTWRITEBYTECODE=1 +# here document in dockerfile src https://stackoverflow.com/questions/40359282/launch-a-cat-command-unix-into-dockerfile +RUN cat > /etc/pip.conf <