Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .coverage
Binary file not shown.
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "tapir",

// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
"../docker-compose.yml",
"docker-compose.dev.override.yml"
],

// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "web",

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/app",
"remoteUser": "noroot",
"shutdownAction": "stopCompose",
}
5 changes: 5 additions & 0 deletions .devcontainer/docker-compose.dev.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
web:
build:
args:
UID: 1000
30 changes: 23 additions & 7 deletions django.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
FROM python:3.13
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY . /app

ARG UID=1000
ARG GID=$UID
ARG USERNAME=noroot

RUN apt-get update -y \
&& apt-get --no-install-recommends install -y \
gettext \
libldap2-dev \
libsasl2-dev \
postgresql-client \
postgresql-client-common \
&& rm -rf /var/lib/apt/lists/* \
&& pip install poetry \
&& poetry install \
&& poetry run python manage.py compilemessages
postgresql-client-common \
python3-poetry \
&& rm -rf /var/lib/apt/lists/*

RUN if [ "$UID" -ne 0 ]; then \
addgroup --gid "$GID" "$USERNAME" \
&& adduser --disabled-password --gecos "" --uid "$UID" --gid "$GID" "$USERNAME"; \
fi

WORKDIR /app
COPY --chown=$UID:$GID . /app
# change ownership of the app dir itself
RUN chown $UID:$GID /app

USER ${UID}:${GID}

RUN poetry config virtualenvs.in-project true

CMD bash -c "poetry install && poetry run python manage.py compilemessages --ignore '.venv' && poetry run python manage.py runserver_plus 0.0.0.0:80"
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ services:
build:
context: .
dockerfile: ./django.Dockerfile
command: bash -c "poetry install &&
poetry run python manage.py compilemessages --ignore \".venv\" &&
poetry run python manage.py runserver_plus 0.0.0.0:80"
args:
UID: 0
volumes:
- .:/app
environment:
Expand Down