BookWyrm: update Dockerfile and env handling

- Remove ARG BOOKWYRM_VERSION default, use Jinja variable directly
- Add proper SMTP environment variables mapping (EMAIL_HOST, EMAIL_PORT, TLS/SSL flags, user, password, default_from)
- Ensure env.j2 uses BookWyrm-expected names only
Ref: ChatGPT conversation 2025-09-02 https://chatgpt.com/share/68b6dc73-3784-800f-9a7e-340be498a412
This commit is contained in:
2025-09-02 14:01:04 +02:00
parent d760c042c2
commit 7c814e6e83
3 changed files with 20 additions and 3 deletions

View File

@@ -1,5 +1,4 @@
# Build BookWyrm from source (no upstream image available) # Build BookWyrm from source (no upstream image available)
ARG BOOKWYRM_VERSION={{ BOOKWYRM_VERSION | default('v0.7.5') }}
FROM python:3.11-bookworm AS builder FROM python:3.11-bookworm AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -9,7 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
WORKDIR /src WORKDIR /src
# Shallow clone the chosen tag/branch # Shallow clone the chosen tag/branch
RUN git clone --depth=1 --branch "${BOOKWYRM_VERSION}" https://github.com/bookwyrm-social/bookwyrm.git . RUN git clone --depth=1 --branch "{{ BOOKWYRM_VERSION }}" https://github.com/bookwyrm-social/bookwyrm.git .
# Pre-install Python deps to a wheelhouse for faster final image # Pre-install Python deps to a wheelhouse for faster final image
RUN pip install --upgrade pip \ RUN pip install --upgrade pip \

View File

@@ -11,7 +11,15 @@ ALLOW_INVITE_REQUESTS={{ BOOKWYRM_ALLOW_INVITE_REQUESTS }}
# Django/Secrets (provide via vault/env in production) # Django/Secrets (provide via vault/env in production)
SECRET_KEY="{{ BOOKWYRM_SECRET_KEY }}" SECRET_KEY="{{ BOOKWYRM_SECRET_KEY }}"
EMAIL="{{ users['no-reply'].email }}"
# Email / SMTP (BookWyrm expects these names)
EMAIL_HOST="{{ EMAIL_HOST }}"
EMAIL_PORT="{{ EMAIL_PORT }}"
EMAIL_USE_TLS={{ EMAIL_USE_TLS }}
EMAIL_USE_SSL={{ EMAIL_USE_SSL }}
EMAIL_HOST_USER="{{ EMAIL_HOST_USER }}"
EMAIL_HOST_PASSWORD="{{ EMAIL_HOST_PASSWORD }}"
DEFAULT_FROM_EMAIL="{{ EMAIL_DEFAULT_FROM }}"
# Database # Database
DATABASE_URL="postgres://{{ database_username }}:{{ database_password }}@{{ database_host }}:{{ database_port }}/{{ database_name }}" DATABASE_URL="postgres://{{ database_username }}:{{ database_password }}@{{ database_host }}:{{ database_port }}/{{ database_name }}"

View File

@@ -45,3 +45,13 @@ BOOKWYRM_REDIS_HOST: "redis"
BOOKWYRM_REDIS_PORT: 6379 BOOKWYRM_REDIS_PORT: 6379
BOOKWYRM_REDIS_BASE_URL: "redis://{{ BOOKWYRM_REDIS_HOST }}:{{ BOOKWYRM_REDIS_PORT }}" BOOKWYRM_REDIS_BASE_URL: "redis://{{ BOOKWYRM_REDIS_HOST }}:{{ BOOKWYRM_REDIS_PORT }}"
BOOKWYRM_REDIS_BROKER_URL: "{{ BOOKWYRM_REDIS_BASE_URL }}/0" BOOKWYRM_REDIS_BROKER_URL: "{{ BOOKWYRM_REDIS_BASE_URL }}/0"
# Email
EMAIL_HOST: "{{ SYSTEM_EMAIL.HOST }}"
EMAIL_PORT: "{{ SYSTEM_EMAIL.PORT }}"
EMAIL_HOST_USER: "{{ users['no-reply'].email }}"
EMAIL_HOST_PASSWORD: "{{ users['no-reply'].mailu_token }}"
# TLS/SSL: If TLS is true → TLS; else → SSL
EMAIL_USE_TLS: "{{ SYSTEM_EMAIL.TLS | ternary('true','false') }}"
EMAIL_USE_SSL: "{{ not SYSTEM_EMAIL.TLS | ternary('true','false') }}"
EMAIL_DEFAULT_FROM: "BookWyrm <{{ users['no-reply'].email }}>"