From ef004ded241f88375075411f73a459a96f2719a9 Mon Sep 17 00:00:00 2001 From: Walter Date: Thu, 20 Feb 2025 19:47:53 +0100 Subject: [PATCH] last commit before dropping the idea of multi-stage builds --- .env.example | 2 +- .gitignore | 3 ++- app/Dockerfile | 8 ++++---- app/requirements.txt | 2 +- docker-compose-example.yml | 8 ++++---- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.env.example b/.env.example index efab9a9..8a7e3f4 100644 --- a/.env.example +++ b/.env.example @@ -5,5 +5,5 @@ SQL_ENGINE=django.db.backends.postgresql SQL_DATABASE=bloonsworld SQL_USER=bloonsworld SQL_PASSWORD=password123 -SQL_HOST=db +SQL_HOST=bloonsworld-db SQL_PORT=5432 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3aa8cdb..2d3c928 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ legacy venv .env *.sqlite3 -*.db \ No newline at end of file +*.db +docker-compose.yml \ No newline at end of file diff --git a/app/Dockerfile b/app/Dockerfile index 802f7ad..30451d8 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -1,6 +1,6 @@ # https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/ -FROM python:3.12.2-slim-buster as builder +FROM python:3.13.2-slim-bullseye AS builder WORKDIR /usr/src/app @@ -14,13 +14,13 @@ RUN apt-get update && \ pip install flake8==6.0.0 COPY . /usr/src/app/ -RUN flake8 --ignore=E501,F401 . +# RUN flake8 --ignore=E501,F401 . COPY ./requirements.txt . RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt -FROM python:3.12.2-alpine3.21 +FROM python:3.13.2-alpine3.21 ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ @@ -31,7 +31,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \ RUN mkdir -p $HOME && \ mkdir $APP_HOME && \ addgroup --system app && \ - adduser --system --group app + adduser --system -G app app WORKDIR $APP_HOME diff --git a/app/requirements.txt b/app/requirements.txt index db77eb6..b59fd97 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -3,7 +3,7 @@ django-crispy-forms==2.3 crispy-bootstrap4==2024.10 django-extensions==3.2.3 tqdm==4.67.1 -Pillow==11.1.0 +Pillow==11.* django-resized==1.0.3 django-cleanup==9.0.0 psycopg2-binary==2.9.10 \ No newline at end of file diff --git a/docker-compose-example.yml b/docker-compose-example.yml index ffb8af8..6dde518 100644 --- a/docker-compose-example.yml +++ b/docker-compose-example.yml @@ -2,9 +2,9 @@ services: bloonsworld: build: ./app volumes: - - ./.media:/app/media:ro - - ./.static:/app/static:rw - - ./.django:/app/data:rw + - ./.data/media:/app/media:ro + - ./.data/static:/app/static:rw + - ./.data/django:/app/data:rw command: - sh - -c @@ -23,7 +23,7 @@ services: bloonsworld-db: image: postgres:17 volumes: - - postgres_data:/var/lib/postgresql/data/ + - ./.data/postgres_data:/var/lib/postgresql/data/ environment: - POSTGRES_USER=$SQL_USER - POSTGRES_PASSWORD=$SQL_PASSWORD