Skip to content
Open
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
10 changes: 7 additions & 3 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# pull official base image
FROM python:3.10-alpine

# create non-root user and group
RUN addgroup -g 1000 app && \
adduser -D -u 1000 -G app -h /home/app -s /bin/sh app

# set work directory
WORKDIR /usr/src/app

Expand All @@ -21,20 +25,20 @@ COPY Roboto-Regular.ttf /root/.fonts/
RUN fc-cache -f

# install dependencies
COPY ./requirements.txt .
COPY --chown=app:app ./requirements.txt .
# hadolint ignore=DL3042
RUN \
--mount=type=cache,target=/root/.cache \
pip install uv==0.1.15 \
&& uv pip install --system -r requirements.txt

# copy entrypoint.sh
COPY ./entrypoint.sh .
COPY --chown=app:app ./entrypoint.sh .
RUN sed -i 's/\r$//g' /usr/src/app/entrypoint.sh \
&& chmod +x /usr/src/app/entrypoint.sh

# copy project
COPY . .
COPY --chown=app:app . .

# run entrypoint.sh
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
services:
web:
user: "1000:1000"
build: ./app
platform: linux/amd64
command: python manage.py runserver 0.0.0.0:8000
Expand Down
21 changes: 21 additions & 0 deletions docs/architecture/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
tags:
- Docker
---

# Docker configuration

## Docker Compose

The project uses docker compose to run a local development environment.

The compose file is stored in the root of the project.

## Dockerfile

The Dockerfile is stored in the `app/` directory.

## Design

- We run Docker containers as a non-root user.
- This is necessary for creating migration files not owned by root and usable by the normal user.
2 changes: 1 addition & 1 deletion docs/contributing/tools/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
These are the tools we use in the PeopleDepot project with notes on how we use them.

- [Convenience scripts](scripts.md)
- [Docker](docker.md) for containerization
- [Docker](./docker.md) for containerization
- [MkDocs](mkdocs.md) for documentation
- [Pre-commit](pre-commit.md) for linting
- [Uv](uv.md) for fast dependency resolution
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ plugins:
- postgres
- Django
- migrations
- Docker

markdown_extensions:
- abbr
Expand Down