New WaitingListEntry #33

Merged
valberg merged 10 commits from benjaoming/membersystem:waiting-list into main 2024-07-31 22:49:48 +00:00
6 changed files with 61 additions and 59 deletions
Showing only changes of commit 801f9fd209 - Show all commits

View file

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

Breaking the single RUN statement into multiple statements means bigger image.

Breaking the single RUN statement into multiple statements means bigger image.

Yes but having to re-run the same things over and over again, creating huge new cache layers every time would be equally bad?

Yes but having to re-run the same things over and over again, creating huge new cache layers every time would be equally bad?

Or which RUN commands is it that you want to see merged here?

Or which RUN commands is it that you want to see merged here?

So apparently the difference is a meager 6MB. The only thing we want is to have the requirements file when installing dependencies and then copy stuff in. I've done that in 0cf579c5f6 (the comical thing is that upgrading to bookworm at the same time has bumped the image size from 583MB to 681MB 😆)

So apparently the difference is a meager 6MB. The only thing we want is to have the requirements file when installing dependencies and then copy stuff in. I've done that in https://git.data.coop/data.coop/membersystem/commit/0cf579c5f6e70b837c487e254532987d7186a56f (the comical thing is that upgrading to bookworm at the same time has bumped the image size from 583MB to 681MB 😆)
COPY . .
RUN mkdir /app/src/static && \
chown www:www /app/src/static
RUN pip install --no-cache-dir -r $REQUIREMENTS_FILE
RUN django-admin compilemessages
RUN django-admin compilemessages
ENTRYPOINT ["./entrypoint.sh"]

View file

@ -6,12 +6,6 @@ MANAGE_COMMAND = ${DOCKER_RUN} app ${MANAGE_EXEC}
run:
${DOCKER_COMPOSE} up
pre_commit_install:
venv/bin/pre-commit install
pre_commit_run_all:
venv/bin/pre-commit run --all-files
makemigrations:
${MANAGE_COMMAND} makemigrations ${ARGS}

View file

@ -84,3 +84,13 @@ make makemigrations
```bash
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" },
]
dependencies = [
"Django==5.0.7",
"django-money==3.5.2",
"django-allauth==0.63.6",
"psycopg[binary]==3.2.1",
"environs[django]==11.0.0",
"uvicorn==0.30.1",
"whitenoise==6.7.0",
"django-zen-queries==2.1.0",
"Django~=5.0",
"django-money~=3.5",
"django-allauth~=0.63",
"psycopg[binary]~=3.2",
"environs[django]>=11,<12",
"uvicorn~=0.30",
"whitenoise~=6.7",
"django-zen-queries~=2.1",
"django-registries==0.0.3",
"django-view-decorator==0.0.4",
"django-oauth-toolkit==2.4.0",
"django-oauth-toolkit~=2.4",
]
version = "0.0.1"
@ -62,11 +62,11 @@ matrix.python.dependencies = [
{ value = "typing_extensions==4.5.0", if = ["3.10"]},
]
[tool.hatch.envs.dev.scripts]
[tool.hatch.envs.default.scripts]
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src --cov=tests --cov=append {args}"
no-cov = "cov --no-cov {args}"
typecheck = "mypy --config-file=pyproject.toml ."
requirements = "pip-compile --output-file requirements/base.txt pyproject.toml"
requirements = "hatch env run --env default -- python --version; hatch env run --env dev -- python --version"
server = "./src/manage.py runserver 0.0.0.0:8000"
migrate = "./src/manage.py migrate"
makemigrations = "./src/manage.py makemigrations"

View file

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

View file

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