From a953bce90eda9f7906f7bc823a4cd60616b1178a Mon Sep 17 00:00:00 2001 From: Markus Rosenstihl Date: Tue, 14 Apr 2026 11:43:35 +0200 Subject: [PATCH] fixed permissions for db.sqlite3 --- .gitignore | 4 ++++ Dockerfile | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..851fc41 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +venv +.venv +__pycache__ +.idea diff --git a/Dockerfile b/Dockerfile index 871253b..ea832f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ # Use the official Python runtime image FROM python:3.13-alpine +#COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ + +# Disable development dependencies +#ENV UV_NO_DEV=1 # Create the app directory RUN mkdir /app -# Set the working directory inside the container -WORKDIR /app # Create a non-privileged user that the app will run under. # See https://docs.docker.com/go/dockerfile-user-best-practices/ @@ -34,6 +36,8 @@ ENV PIP_ROOT_USER_ACTION=ignore # Leverage a cache mount to /root/.cache/pip to speed up subsequent builds. # Leverage a bind mount to requirements.txt to avoid having to copy them into # into this layer. +# using pip (uv is below) + RUN --mount=type=cache,target=/root/.cache/pip \ --mount=type=bind,source=requirements.txt,target=/requirements.txt \ python -m pip install -r /requirements.txt @@ -41,6 +45,8 @@ RUN --mount=type=cache,target=/root/.cache/pip \ ## run this command to install all dependencies #RUN pip install --no-cache-dir -r requirements.txt ##RUN pip install --no-cache-dir django-tailwind + +RUN chown appuser:appuser /app # Switch to the non-privileged user to run the application. USER appuser @@ -55,7 +61,11 @@ COPY --chown=appuser:appuser manage.py db.sqlite3 /app/ # Expose the Django port EXPOSE 8000 + +# Set the working directory inside the container +WORKDIR /app + +#RUN uv sync --locked # Run Django’s development server -CMD ["python", "manage.py", "migrate"] CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]