Fix and doc container
All checks were successful
/ test (push) Successful in 5s

This commit is contained in:
phil 2024-12-05 05:41:57 +01:00
parent d669251515
commit 087a343ebc
5 changed files with 19 additions and 15 deletions

View file

@ -3,15 +3,13 @@
Use `podman` or `docker`:
```sh
podman run tiptop:5000/sms_handler
podman run registry.philo.ydns.eu/philo/sms_handler
```
**Note**: the container is not published publicly yet!
Pass parameters like this:
Parameters are given as environment variables, eg.:
```sh
podman run -e SMS_HANDLER_MAIL_SERVER_PORT=8025 -e SMS_HANDLER_MAIL_SENDER=snoopy@peanuts.com SMS_HANDLER_MAIL_TO=snoopy@peanuts.com tiptop:5000/sms_handler
podman run -e SMS_HANDLER_MAIL_SERVER_PORT=8025 -e SMS_HANDLER_MAIL_SENDER=snoopy@peanuts.com SMS_HANDLER_MAIL_TO=snoopy@peanuts.com registry.philo.ydns.eu/philo/sms_handler
```
## Container as a systemd service
@ -20,14 +18,15 @@ Systemd can "orchestrate" containers easily thanks to podman.
### Rootless (as regular user)
For a rootless container, create a file in `.config/containers/systemd/sms-handler.container`:
For a rootless container, create a file in `.config/containers/systemd/sms-handler.container`.
The configuration is given as environment variables (email addresses `snoopy@peanuts.com` in this example):
```systemd
[Container]
ContainerName=sms-handler
Environment=SMS_HANDLER_MAIL_SENDER=snoopy@peanuts.com
Environment=SMS_HANDLER_MAIL_TO=snoopy@peanuts.com
Image=tiptop:5000/sms_handler
Image=registry.philo.ydns.eu/philo/sms_handler
Network=podman
PublishPort=8025:8025
@ -65,7 +64,7 @@ For a rootless container, create a file in `/etc/containers/systemd/sms-handler.
ContainerName=sms-handler
Environment=SMS_HANDLER_MAIL_SENDER=snoopy@peanuts.com
Environment=SMS_HANDLER_MAIL_TO=snoopy@peanuts.com
Image=tiptop:5000/sms_handler
Image=registry.philo.ydns.eu/philo/sms_handler
Network=podman
PublishPort=8025:8025
@ -87,4 +86,3 @@ Start the container as a service:
```sh
sudo systemctl start sms-handler.service
```

View file

@ -1,4 +1,4 @@
# Build: podman build -t sms-handler -f Containerfile
# Build: podman build -t registry.philo.ydns.eu/philo/sms_handler -f Containerfile
FROM docker.io/python:3.12-alpine
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/
@ -9,6 +9,6 @@ ENV SMS_HANDLER_MAIL_SERVER=host.containers.internal
COPY . /src
WORKDIR /src
RUN uv sync --frozen --no-cache
RUN uv sync --frozen --no-cache && uv pip install --system .
CMD .venv/bin/fastapi run server.py --port ${PORT} --host ${LISTEN_ADDR}
CMD sms-handler --port ${PORT} --host ${LISTEN_ADDR}

View file

@ -108,6 +108,13 @@ Restart=on-failure
WantedBy=default.target
```
### Run in a container
*Sms-handler* is also packaged as a container for running with *docker*,
*podman*, or *Kunernetes*.
See `CONTAINER.md` for the details.
## Run behind a reverse proxy
*sms-handler* can run behind a reverse proxy (Nginx, Apache, Lighttpd, HAProxy, Caddy, Traefik, etc),
@ -163,4 +170,3 @@ for notification on various devices and automation.
*sms-handler* is BSD licensed. Suggestions and contributions are welcome.
<a href="https://liberapay.com/Philo/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>

View file

@ -1,6 +1,6 @@
[project]
name = "sms_handler"
version = "0.0.4"
version = "0.0.5"
#dynamic = ["version"]
description = "Listen to messages from the SMS Forwarder app on Android and send mail"
readme = "README.md"

2
uv.lock generated
View file

@ -255,7 +255,7 @@ wheels = [
[[package]]
name = "sms-handler"
version = "0.0.1"
version = "0.0.4"
source = { editable = "." }
dependencies = [
{ name = "aiosmtplib" },