Skip to content

Commit

Permalink
docker: update dependencies and migrate from j2cli to jinjanator
Browse files Browse the repository at this point in the history
  • Loading branch information
verdel committed Feb 15, 2024
1 parent 97c552e commit e975b3b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.11 as builder
FROM python:3.12 as builder

RUN pip install poetry==1.6.1
RUN pip install poetry==1.7.1

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
Expand All @@ -13,9 +13,9 @@ COPY pyproject.toml poetry.lock ./

RUN poetry install --without dev --no-root

FROM python:3.11-slim as runtime
FROM python:3.12-slim as runtime

RUN pip install j2cli
RUN pip install jinjanator jinjanator-plugin-ansible

ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"
Expand Down
2 changes: 1 addition & 1 deletion docker/rootfs/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

if [ -f /opt/transmission-telegram-bot/config.yml.j2 ];then
j2 --filter /opt/j2cli/env_json.py -o /opt/transmission-telegram-bot/config.yml /opt/transmission-telegram-bot/config.yml.j2
jinjanate -o /opt/transmission-telegram-bot/config.yml --quiet /opt/transmission-telegram-bot/config.yml.j2
rm /opt/transmission-telegram-bot/config.yml.j2
fi

Expand Down
11 changes: 0 additions & 11 deletions docker/rootfs/opt/j2cli/env_json.py

This file was deleted.

4 changes: 2 additions & 2 deletions docker/rootfs/opt/transmission-telegram-bot/config.yml.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
telegram:
token: {{ TELEGRAM_TOKEN }}
allow_chat:
{% for item in ALLOW_CHAT|env_json %}
{% for item in ALLOW_CHAT | from_json %}
- telegram_id: {{ item['telegram_id'] }}
torrent_permission: '{{ item['torrent_permission'] }}'
notify: {{ item['notify'] | default("personal") }}
Expand All @@ -21,7 +21,7 @@ transmission:
user: {{ TRANSMISSION_USERNAME }}
password: {{ TRANSMISSION_PASSWORD }}
path:
{% for item in TRANSMISSION_PATH|env_json %}
{% for item in TRANSMISSION_PATH | from_json %}
- category: {{ item['category'] }}
dir: '{{ item['dir'] }}'
{% endfor %}
Expand Down

0 comments on commit e975b3b

Please sign in to comment.