Skip to content
Merged
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
11 changes: 4 additions & 7 deletions .docker/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
FROM python:3.9-bullseye
FROM python:3.13-trixie

ENV PYTHONUNBUFFERED=1

COPY entrypoint.sh /

WORKDIR /code

RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

RUN apt update && \
apt install -y postgresql-client-15 && \
pip3 install --upgrade pip pipenv
apt install -y postgresql-client-17 && \
python -m pip install pipenv

ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
19 changes: 12 additions & 7 deletions .docker/web/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
source .env

# Install or update dependencies on every start in case something changed
python3 -m pipenv install --dev
pipenv install --dev

# Some users prefer to develop on their host rather than containers and have adjusted .env
if [ $POSTGRES_HOST == "localhost" ]; then
echo -e "\033[33mWARNING: Your \$POSTGRES_HOST variable points to localhost not db!\033[0m"
fi

# Wait for database to be available before running migrations
until pg_isready -h "$POSTGRES_HOST" -U "$POSTGRES_USER" &> /dev/null; do
Expand All @@ -12,22 +17,22 @@ until pg_isready -h "$POSTGRES_HOST" -U "$POSTGRES_USER" &> /dev/null; do
done

# Apply pending migrations on every start
python3 -m pipenv run python -m serveradmin migrate --no-input
pipenv run python -m serveradmin migrate --no-input

# Requires Django >= 3.x
# pipenv run python -m serveradmin createsuper --no-input
python3 -m pipenv run python -m serveradmin createdefaultuser
pipenv run python -m serveradmin createdefaultuser

# Create default application
python3 -m pipenv run python -m serveradmin createapp --non-interactive
pipenv run python -m serveradmin createapp --non-interactive

echo -e "
********************************************************************************

\e[32m[TIPS]\e[39m
- Run 'docker compose exec web /bin/bash' to access web service
- Run 'python3 -m pipenv run python -m serveradmin -h' in web service to access django commands
- Run 'python3 -m pipenv run python -m adminapi example.com' in web service to make adminapi queries
- Run 'pipenv run python -m serveradmin -h' in web service to access django commands
- Run 'pipenv run python -m adminapi example.com' in web service to make adminapi queries

\e[33mAccess serveradmin from your browser via:\e[39m
- URL: http://127.0.0.1:8000
Expand All @@ -38,4 +43,4 @@ echo -e "
"

# Start development server reachable for host machine
python3 -m pipenv run python -m serveradmin runserver 0.0.0.0:8000
pipenv run python -m serveradmin runserver 0.0.0.0:8000
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
matrix:
python:
- "3.9"
- "3.10"
- "3.13"

services:
db:
image: 'postgres:15'
image: 'postgres:17'
env:
POSTGRES_USER: serveradmin
POSTGRES_PASSWORD: serveradmin
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ faker = "<14.0.0"
tblib = "*"

[requires]
python_version = "3.9"
python_version = "3.13"

[production]
sentry-sdk = {version = "*", extras = ["django"]}
Loading
Loading