Use hatch for installing.

This commit is contained in:
Víðir Valberg Guðmundsson 2024-03-03 11:05:08 +01:00
parent fedfca25a5
commit 712c50fac7
3 changed files with 18 additions and 15 deletions

View file

@ -5,3 +5,5 @@
!src/ !src/
!requirements/ !requirements/
!entrypoint.sh !entrypoint.sh
!pyproject.toml
!README.md

View file

@ -11,7 +11,13 @@ ARG DJANGO_ENV
ARG BUILD ARG BUILD
ENV BUILD ${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 \ && apt-get install -y \
binutils \ binutils \
libpq-dev \ libpq-dev \
@ -23,15 +29,9 @@ RUN apt-get update \
libgdk-pixbuf2.0-0 \ libgdk-pixbuf2.0-0 \
libffi-dev \ libffi-dev \
shared-mime-info \ shared-mime-info \
gettext gettext \
&& pip install . \
WORKDIR /app && django-admin compilemessages
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
ENTRYPOINT ["./entrypoint.sh"] ENTRYPOINT ["./entrypoint.sh"]

View file

@ -1,5 +1,5 @@
[build-system] [build-system]
requires = ["hatchling", "hatch-vcs"] requires = ["hatchling"]
build-backend = "hatchling.build" build-backend = "hatchling.build"
[project] [project]
@ -22,11 +22,12 @@ dependencies = [
"django-zen-queries==2.1.0", "django-zen-queries==2.1.0",
"django-registries==0.0.3", "django-registries==0.0.3",
"django-view-decorator==0.0.4", "django-view-decorator==0.0.4",
"django-oauth-toolkit==2.3.0",
] ]
dynamic = ["version"] version = "0.0.1"
[tool.hatch.version] [tool.hatch.build.targets.wheel]
source = "vcs" packages = ["src"]
[tool.hatch.envs.default] [tool.hatch.envs.default]
dependencies = [ dependencies = [
@ -59,7 +60,7 @@ cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src --
no-cov = "cov --no-cov {args}" no-cov = "cov --no-cov {args}"
typecheck = "mypy --config-file=pyproject.toml ." typecheck = "mypy --config-file=pyproject.toml ."
requirements = "pip-compile --output-file requirements/base.txt 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" migrate = "./src/manage.py migrate"
makemigrations = "./src/manage.py makemigrations" makemigrations = "./src/manage.py makemigrations"
createsuperuser = "./src/manage.py createsuperuser" createsuperuser = "./src/manage.py createsuperuser"