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
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
.venv
local_settings.py
*.db
collected_static
htmlcov
**/__pycache__

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sadly not vendor neutral, there is containerignore but ofcourse docker does not support that....

26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM archlinux:latest

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a Containerfile, which both podman/docker should support.


RUN pacman -Syu --noconfirm --needed git python uv wget && pacman -Scc --noconfirm

WORKDIR /app

# Keep the virtualenv outside /app so it survives bind-mounting the source
ENV UV_PROJECT_ENVIRONMENT=/opt/venv
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-install-project

COPY . .

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I suppose this is why you neeed the .dockerignore? As you copy the whole working directory over?


# Fetch the style submodule if it was not initialized in the build context
RUN [ -e archlinux_common_style/django ] || \
(rm -rf archlinux_common_style && \
git clone --depth 1 https://gitlab.archlinux.org/archlinux/archlinux-common-style.git archlinux_common_style)

RUN cp local_settings.py.example local_settings.py && \
sed -i 's/^DEBUG = False/DEBUG = True/' local_settings.py

EXPOSE 8000

CMD ["sh", "-c", "uv run ./manage.py migrate && \
uv run ./manage.py loaddata main/fixtures/*.json devel/fixtures/*.json mirrors/fixtures/*.json releng/fixtures/*.json && \
uv run ./manage.py runserver 0.0.0.0:8000"]
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,43 @@ probably want the following:

# Testing Installation

## Docker (recommended)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this recommended? I would like to use Podman instead for example.


The provided `Dockerfile` builds an Arch Linux based development environment
in a single container. It uses SQLite, sets `DEBUG = True`, runs the migrations,
loads the fixtures and starts the development server.

1. Build the image:

docker build -t archweb-dev .

2. Start the container:

docker run --rm --name archweb -p 8000:8000 archweb-dev

Archweb is now available at <http://localhost:8000>.

3. Create a superuser (optional). The fixtures do not contain any users, and
registering an account requires an SMTP server.

docker exec -e DJANGO_SUPERUSER_PASSWORD=admin archweb \
uv run ./manage.py createsuperuser --noinput --username admin --email admin@example.com

4. Populate the database with real package data (optional):

docker exec archweb sh -c '
wget https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db.tar.gz &&
uv run ./manage.py reporead x86_64 core.db.tar.gz &&
wget https://geo.mirror.pkgbuild.com/core/os/x86_64/core.files.tar.gz &&
uv run ./manage.py reporead --filesonly x86_64 core.files.tar.gz'

See step 8 of the local installation below for customization notes.

All data is stored inside the container and is lost when the container is
removed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is useful to keep the DB around or allow bind mounting it?


## Local installation

1. Run `uv sync`.
2. Initialize git submodules:

Expand Down
Loading