Compare commits

..

No commits in common. "981fde132239c2926fc72bcb00ac7a7ef6f57d73" and "a71c706a392d8f9b8a4d5facb29d3e9d087f4815" have entirely different histories.

5 changed files with 53 additions and 61 deletions

View file

@ -1,4 +1,4 @@
FROM python:3.12-slim-bookworm FROM python:3.12-slim-bullseye
# PYTHONFAULTHANDLER: Propagate tracebacks from all threads. # PYTHONFAULTHANDLER: Propagate tracebacks from all threads.
# PYTHONUNBUFFERED: Write terminal output straight to docker (to not confuse Docker Compose). # PYTHONUNBUFFERED: Write terminal output straight to docker (to not confuse Docker Compose).
@ -13,19 +13,14 @@ ENV PYTHONFAULTHANDLER=1 \
PIP_DISABLE_PIP_VERSION_CHECK=on \ PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 PIP_DEFAULT_TIMEOUT=100
ARG BUILD ARG BUILD
ENV BUILD=${BUILD} ENV BUILD ${BUILD}
ARG REQUIREMENTS_FILE=requirements.txt ARG REQUIREMENTS_FILE=requirements.txt
WORKDIR /app WORKDIR /app
RUN groupadd -g 1000 www && useradd -u 1000 -ms /bin/bash -g www www RUN groupadd -g 1000 www && useradd -u 1000 -ms /bin/bash -g www www
COPY --chown=www:www . .
# Only copy the requirements file first to leverage Docker cache RUN apt-get update && \
COPY $REQUIREMENTS_FILE .
RUN mkdir -p /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 \
@ -37,13 +32,15 @@ RUN mkdir -p /app/src/static && \
libgdk-pixbuf2.0-0 \ libgdk-pixbuf2.0-0 \
libffi-dev \ libffi-dev \
shared-mime-info \ shared-mime-info \
gettext && \ gettext
pip install --no-cache-dir -r $REQUIREMENTS_FILE
# Copy the rest of the application COPY --chown=www:www . .
COPY . .
RUN django-admin compilemessages RUN mkdir /app/src/static && \
chown www:www /app/src/static
RUN pip install --no-cache-dir -r $REQUIREMENTS_FILE
RUN django-admin compilemessages
ENTRYPOINT ["./entrypoint.sh"] ENTRYPOINT ["./entrypoint.sh"]

View file

@ -84,13 +84,3 @@ make makemigrations
```bash ```bash
hatch run dev:server hatch run dev:server
``` ```
#### Updating requirements
If you want to update the requirements, you can run the following command:
```bash
hatch run requirements
```
This uses [hatch-pip-compile](https://juftin.com/hatch-pip-compile/) to update the requirements.

View file

@ -12,17 +12,17 @@ authors = [
{ name = "Víðir Valberg Guðmundsson", email = "valberg@orn.li" }, { name = "Víðir Valberg Guðmundsson", email = "valberg@orn.li" },
] ]
dependencies = [ dependencies = [
"Django~=5.0", "Django==5.0.7",
"django-money~=3.5", "django-money==3.5.2",
"django-allauth~=0.63", "django-allauth==0.63.6",
"psycopg[binary]~=3.2", "psycopg[binary]==3.2.1",
"environs[django]>=11,<12", "environs[django]==11.0.0",
"uvicorn~=0.30", "uvicorn==0.30.1",
"whitenoise~=6.7", "whitenoise==6.7.0",
"django-zen-queries~=2.1", "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.4", "django-oauth-toolkit==2.4.0",
] ]
version = "0.0.1" version = "0.0.1"
@ -62,11 +62,11 @@ matrix.python.dependencies = [
{ value = "typing_extensions==4.5.0", if = ["3.10"]}, { value = "typing_extensions==4.5.0", if = ["3.10"]},
] ]
[tool.hatch.envs.default.scripts] [tool.hatch.envs.dev.scripts]
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src --cov=tests --cov=append {args}" cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src --cov=tests --cov=append {args}"
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 = "hatch env run --env default -- python --version; hatch env run --env dev -- python --version" requirements = "pip-compile --output-file requirements/base.txt pyproject.toml"
server = "./src/manage.py runserver 0.0.0.0:8000" 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"

View file

@ -1,17 +1,17 @@
# #
# This file is autogenerated by hatch-pip-compile with Python 3.12 # This file is autogenerated by hatch-pip-compile with Python 3.12
# #
# - django-allauth~=0.63 # - django-allauth==0.63.6
# - django-money~=3.5 # - django-money==3.5.2
# - django-oauth-toolkit~=2.4 # - django-oauth-toolkit==2.4.0
# - django-registries==0.0.3 # - django-registries==0.0.3
# - django-view-decorator==0.0.4 # - django-view-decorator==0.0.4
# - django-zen-queries~=2.1 # - django-zen-queries==2.1.0
# - django~=5.0 # - django==5.0.7
# - environs[django]<12,>=11 # - environs[django]==11.0.0
# - psycopg[binary]~=3.2 # - psycopg[binary]==3.2.1
# - uvicorn~=0.30 # - uvicorn==0.30.1
# - whitenoise~=6.7 # - whitenoise==6.7.0
# #
asgiref==3.8.1 asgiref==3.8.1
@ -26,7 +26,7 @@ charset-normalizer==3.3.2
# via requests # via requests
click==8.1.7 click==8.1.7
# via uvicorn # via uvicorn
cryptography==43.0.0 cryptography==42.0.8
# via jwcrypto # via jwcrypto
dj-database-url==2.2.0 dj-database-url==2.2.0
# via environs # via environs
@ -94,7 +94,7 @@ typing-extensions==4.12.2
# py-moneyed # py-moneyed
urllib3==2.2.2 urllib3==2.2.2
# via requests # via requests
uvicorn==0.30.3 uvicorn==0.30.1
# via hatch.envs.default # via hatch.envs.default
whitenoise==6.7.0 whitenoise==6.7.0
# via hatch.envs.default # via hatch.envs.default

View file

@ -11,17 +11,17 @@
# - django-debug-toolbar==4.2.0 # - django-debug-toolbar==4.2.0
# - django-browser-reload==1.7.0 # - django-browser-reload==1.7.0
# - model-bakery==1.17.0 # - model-bakery==1.17.0
# - django-allauth~=0.63 # - django-allauth==0.63.6
# - django-money~=3.5 # - django-money==3.5.2
# - django-oauth-toolkit~=2.4 # - django-oauth-toolkit==2.4.0
# - django-registries==0.0.3 # - django-registries==0.0.3
# - django-view-decorator==0.0.4 # - django-view-decorator==0.0.4
# - django-zen-queries~=2.1 # - django-zen-queries==2.1.0
# - django~=5.0 # - django==5.0.7
# - environs[django]<12,>=11 # - environs[django]==11.0.0
# - psycopg[binary]~=3.2 # - psycopg[binary]==3.2.1
# - uvicorn~=0.30 # - uvicorn==0.30.1
# - whitenoise~=6.7 # - whitenoise==6.7.0
# #
asgiref==3.8.1 asgiref==3.8.1
@ -45,8 +45,9 @@ click==8.1.7
coverage==7.3.0 coverage==7.3.0
# via # via
# hatch.envs.dev # hatch.envs.dev
# coverage
# pytest-cov # pytest-cov
cryptography==43.0.0 cryptography==42.0.8
# via jwcrypto # via jwcrypto
dj-database-url==2.2.0 dj-database-url==2.2.0
# via environs # via environs
@ -83,14 +84,16 @@ django-registries==0.0.3
# via hatch.envs.dev # via hatch.envs.dev
django-stubs==1.16.0 django-stubs==1.16.0
# via hatch.envs.dev # via hatch.envs.dev
django-stubs-ext==5.0.4 django-stubs-ext==5.0.2
# via django-stubs # via django-stubs
django-view-decorator==0.0.4 django-view-decorator==0.0.4
# via hatch.envs.dev # via hatch.envs.dev
django-zen-queries==2.1.0 django-zen-queries==2.1.0
# via hatch.envs.dev # via hatch.envs.dev
environs==11.0.0 environs==11.0.0
# via hatch.envs.dev # via
# hatch.envs.dev
# environs
h11==0.14.0 h11==0.14.0
# via uvicorn # via uvicorn
idna==3.7 idna==3.7
@ -121,7 +124,9 @@ pip-tools==7.3.0
pluggy==1.5.0 pluggy==1.5.0
# via pytest # via pytest
psycopg==3.2.1 psycopg==3.2.1
# via hatch.envs.dev # via
# hatch.envs.dev
# psycopg
psycopg-binary==3.2.1 psycopg-binary==3.2.1
# via psycopg # via psycopg
py-moneyed==3.0 py-moneyed==3.0
@ -153,7 +158,7 @@ tomli==2.0.1
# via django-stubs # via django-stubs
types-pytz==2024.1.0.20240417 types-pytz==2024.1.0.20240417
# via django-stubs # via django-stubs
types-pyyaml==6.0.12.20240724 types-pyyaml==6.0.12.20240311
# via django-stubs # via django-stubs
typing-extensions==4.12.2 typing-extensions==4.12.2
# via # via
@ -166,7 +171,7 @@ typing-extensions==4.12.2
# py-moneyed # py-moneyed
urllib3==2.2.2 urllib3==2.2.2
# via requests # via requests
uvicorn==0.30.3 uvicorn==0.30.1
# via hatch.envs.dev # via hatch.envs.dev
wheel==0.43.0 wheel==0.43.0
# via pip-tools # via pip-tools