Skip to content

Commit d240e72

Browse files
committed
Update docker compose and pipenv setup
- Use Python 3.13 for pipenv (does not support ranges) - Use Debian Trixie with Python 3.13 for docker compose
1 parent 3309002 commit d240e72

4 files changed

Lines changed: 236 additions & 223 deletions

File tree

.docker/web/Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ COPY entrypoint.sh /
66

77
WORKDIR /code
88

9-
RUN echo "deb http://apt.postgresql.org/pub/repos/apt trixie-pgdg main" > /etc/apt/sources.list.d/pgdg.list
10-
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
11-
129
RUN apt update && \
1310
apt install -y postgresql-client-17 && \
14-
pip3 install --upgrade pip pipenv
11+
python -m pip install pipenv
1512

16-
ENTRYPOINT ["/entrypoint.sh"]
13+
ENTRYPOINT ["/entrypoint.sh"]

.docker/web/entrypoint.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
source .env
44

55
# Install or update dependencies on every start in case something changed
6-
python3 -m pipenv install --dev
6+
pipenv install --dev
7+
8+
# Some users prefer to develop on their host rather than containers and have adjusted .env
9+
if [ $POSTGRES_HOST == "localhost" ]; then
10+
echo -e "\033[33mWARNING: Your \$POSTGRES_HOST variable points to localhost not db!\033[0m"
11+
fi
712

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

1419
# Apply pending migrations on every start
15-
python3 -m pipenv run python -m serveradmin migrate --no-input
20+
pipenv run python -m serveradmin migrate --no-input
1621

1722
# Requires Django >= 3.x
1823
# pipenv run python -m serveradmin createsuper --no-input
19-
python3 -m pipenv run python -m serveradmin createdefaultuser
24+
pipenv run python -m serveradmin createdefaultuser
2025

2126
# Create default application
22-
python3 -m pipenv run python -m serveradmin createapp --non-interactive
27+
pipenv run python -m serveradmin createapp --non-interactive
2328

2429
echo -e "
2530
********************************************************************************
2631
2732
\e[32m[TIPS]\e[39m
2833
- Run 'docker compose exec web /bin/bash' to access web service
29-
- Run 'python3 -m pipenv run python -m serveradmin -h' in web service to access django commands
30-
- Run 'python3 -m pipenv run python -m adminapi example.com' in web service to make adminapi queries
34+
- Run 'pipenv run python -m serveradmin -h' in web service to access django commands
35+
- Run 'pipenv run python -m adminapi example.com' in web service to make adminapi queries
3136
3237
\e[33mAccess serveradmin from your browser via:\e[39m
3338
- URL: http://127.0.0.1:8000
@@ -38,4 +43,4 @@ echo -e "
3843
"
3944

4045
# Start development server reachable for host machine
41-
python3 -m pipenv run python -m serveradmin runserver 0.0.0.0:8000
46+
pipenv run python -m serveradmin runserver 0.0.0.0:8000

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ faker = "<14.0.0"
4646
tblib = "*"
4747

4848
[requires]
49-
python_version = "3.9"
49+
python_version = "3.13"
5050

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

0 commit comments

Comments
 (0)