ADD: initial commit

This commit is contained in:
Dominik Meyer 2023-12-20 13:37:33 +01:00
commit 77125cdb30
5 changed files with 188 additions and 0 deletions

32
Containerfile Normal file
View File

@ -0,0 +1,32 @@
FROM docker.io/library/golang:alpine AS builder
#
LABEL org.opencontainers.image.source=https://github.com/skx/rss2email/
# Ensure we have git
RUN apk update && apk add --no-cache git
# checkout rss2email
RUN git clone https://github.com/skx/rss2email.git $GOPATH/src/github.com/skx/rss2email/
# Create a working-directory
WORKDIR $GOPATH/src/github.com/skx/rss2email/
# Build the binary.
RUN go build -o /go/bin/rss2email
FROM alpine
RUN apk update && apk add --no-cache msmtp tini bash
# Create a working directory
WORKDIR /app
# Copy the binary.
COPY --from=builder /go/bin/rss2email /app/
ADD scripts/createMSMTPconfig.sh /createMSMTPconfig.sh
ADD scripts/entryPoint.sh /entryPoint.sh
RUN chmod +x /entryPoint.sh
RUN chmod +x /createMSMTPconfig.sh
ENTRYPOINT ["/sbin/tini", "--", "/entryPoint.sh"]

21
License Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

50
README.md Normal file
View File

@ -0,0 +1,50 @@
# RSS2Email Container Image
This repository contains the Containerfile and associated scripts for a container image that runs [rss2email](https://github.com/skx/rss2email).
The Containerfile is heavily based on the Dockerfile provided by [rss2email](https://github.com/skx/rss2email).
## Author
- Dominik Meyer <dmeyer@federationhq.de>
## Prerequisites
- Buildah
## Usage
### Building the Container Image
You can build the container image using the following command:
\```bash
buildah bud -t rss2email:latest .
\```
### Running the Container
You can create and run a container from this image with the following command:
\```bash
podman run -d --name rss2email rss2email:latest
\```
### Pushing the Container Image to a Registry
With Buildah:
\```bash
buildah push rss2email:latest docker://<registry>/<username>/rss2email:latest
\```
Replace `<registry>` with the name of your Docker registry and `<username>` with your username on that registry.
## Configuration
The configuration of rss2email is done via environment variables. You can specify these on the Docker run command line with the `-e` option or define them in an environment variable file and specify that with the `--env-file` option.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

66
scripts/createMSMTPconfig.sh Executable file
View File

@ -0,0 +1,66 @@
#!/bin/bash
if [ -z "${USE_MSMTP}" ]; then
exit 0;
fi
if [ -z "${MSMTP_SMTP_HOST}" ]; then
echo "missing required parameter <SMTP_HOST>"
exit 255
fi
if [ -z "${MSMTP_SMTP_PORT}" ]; then
MSMTP_SMTP_PORT=25
fi
if [ -z "${MSMTP_SMTP_FROM}" ]; then
echo "missing required parameter <SMTP_FROM>"
exit 255
fi
if [ -z "${MSMTP_SMTP_AUTH}" ]; then
MSMTP_SMTP_AUTH=off
fi
if [ -z "${MSMTP_SMTP_TLS}" ]; then
MSMTP_SMTP_TLS=off
fi
if [ "${MSMTP_SMTP_AUTH}" != "off" ]; then
if [ -z "${MSMTP_SMTP_USER}" ]; then
echo "missing required parameter <SMTP_USER>"
exit 255
fi
if [ -z "${MSMTP_SMTP_PASS}" ]; then
echo "missing required parameter <SMTP_PASS>"
exit 255
fi
else
MSMTP_SMTP_USER="dummy"
MSMTP_SMTP_PASS="dummy"
fi
cat > /etc/msmtprc <<EOF
defaults
auth ${MSMTP_SMTP_AUTH}
tls ${MSMTP_SMTP_TLS}
logfile /dev/stdout
account default
host ${MSMTP_SMTP_HOST}
port ${MSMTP_SMTP_PORT}
from ${MSMTP_SMTP_FROM}
user ${MSMTP_SMTP_USER}
password ${MSMTP_SMTP_PASS}
EOF
chmod 600 /etc/msmtprc
# we use msmtp as a dropin replacement for sendmail
rm /usr/sbin/sendmail
ln -s /usr/bin/msmtp /usr/sbin/sendmail

19
scripts/entryPoint.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
/createMSMTPconfig.sh
if [ -z ${RECIPIENTS} ]; then
echo "RECIPIENTS environment variable missing"
exit 255
fi
if [ -z ${FEEDS} ]; then
echo "FEEDS environment variable missing"
exit 255
fi
mkdir -p ~/.rss2email/
echo ${FEEDS} > ~/.rss2email/feeds.txt
/app/rss2email daemon ${RECIPIENTS}