From 712c50fac781b2ae3f95846ae4eb006fae19e226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sun, 3 Mar 2024 11:05:08 +0100 Subject: [PATCH] Use hatch for installing. --- .dockerignore | 2 ++ Dockerfile | 20 ++++++++++---------- pyproject.toml | 11 ++++++----- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.dockerignore b/.dockerignore index d9671a8..ed0835d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,3 +5,5 @@ !src/ !requirements/ !entrypoint.sh +!pyproject.toml +!README.md diff --git a/Dockerfile b/Dockerfile index 3e3971a..cc600b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,13 @@ ARG DJANGO_ENV ARG BUILD ENV BUILD ${BUILD} -RUN apt-get update \ +WORKDIR /app + +RUN groupadd -g 1000 www && useradd -u 1000 -ms /bin/bash -g www www +COPY --chown=www:www . . +RUN mkdir /app/src/static \ + && chown www:www /app/src/static \ + && apt-get update \ && apt-get install -y \ binutils \ libpq-dev \ @@ -23,15 +29,9 @@ RUN apt-get update \ libgdk-pixbuf2.0-0 \ libffi-dev \ shared-mime-info \ - gettext - -WORKDIR /app - -RUN groupadd -g 1000 www && useradd -u 1000 -ms /bin/bash -g www www -COPY --chown=www:www . /app/ -RUN mkdir /app/src/static && chown www:www /app/src/static -RUN pip install -r requirements/$([ "$DJANGO_ENV" = "production" ] && echo "base.txt" || echo "dev.txt") &&\ - django-admin compilemessages + gettext \ + && pip install . \ + && django-admin compilemessages ENTRYPOINT ["./entrypoint.sh"] diff --git a/pyproject.toml b/pyproject.toml index 5d27e93..85da85f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["hatchling", "hatch-vcs"] +requires = ["hatchling"] build-backend = "hatchling.build" [project] @@ -22,11 +22,12 @@ dependencies = [ "django-zen-queries==2.1.0", "django-registries==0.0.3", "django-view-decorator==0.0.4", + "django-oauth-toolkit==2.3.0", ] -dynamic = ["version"] +version = "0.0.1" -[tool.hatch.version] -source = "vcs" +[tool.hatch.build.targets.wheel] +packages = ["src"] [tool.hatch.envs.default] dependencies = [ @@ -59,7 +60,7 @@ cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src -- no-cov = "cov --no-cov {args}" typecheck = "mypy --config-file=pyproject.toml ." requirements = "pip-compile --output-file requirements/base.txt pyproject.toml" -server = "./src/manage.py runserver" +server = "./src/manage.py runserver 0.0.0.0:8000" migrate = "./src/manage.py migrate" makemigrations = "./src/manage.py makemigrations" createsuperuser = "./src/manage.py createsuperuser"