From 77125cdb30b40c7d0c3024a4e1ea5ae74a153092 Mon Sep 17 00:00:00 2001 From: Dominik Meyer Date: Wed, 20 Dec 2023 13:37:33 +0100 Subject: [PATCH] ADD: initial commit --- Containerfile | 32 +++++++++++++++++ License | 21 ++++++++++++ README.md | 50 +++++++++++++++++++++++++++ scripts/createMSMTPconfig.sh | 66 ++++++++++++++++++++++++++++++++++++ scripts/entryPoint.sh | 19 +++++++++++ 5 files changed, 188 insertions(+) create mode 100644 Containerfile create mode 100644 License create mode 100644 README.md create mode 100755 scripts/createMSMTPconfig.sh create mode 100755 scripts/entryPoint.sh diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..e4a413d --- /dev/null +++ b/Containerfile @@ -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"] \ No newline at end of file diff --git a/License b/License new file mode 100644 index 0000000..8aa2645 --- /dev/null +++ b/License @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..47607b4 --- /dev/null +++ b/README.md @@ -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 + + +## 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:////rss2email:latest +\``` + +Replace `` with the name of your Docker registry and `` 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. diff --git a/scripts/createMSMTPconfig.sh b/scripts/createMSMTPconfig.sh new file mode 100755 index 0000000..d05ff7a --- /dev/null +++ b/scripts/createMSMTPconfig.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +if [ -z "${USE_MSMTP}" ]; then + exit 0; +fi + +if [ -z "${MSMTP_SMTP_HOST}" ]; then + echo "missing required parameter " + exit 255 +fi + +if [ -z "${MSMTP_SMTP_PORT}" ]; then + MSMTP_SMTP_PORT=25 +fi + + +if [ -z "${MSMTP_SMTP_FROM}" ]; then + echo "missing required parameter " + 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 " + exit 255 + fi + + if [ -z "${MSMTP_SMTP_PASS}" ]; then + echo "missing required parameter " + exit 255 + fi +else + MSMTP_SMTP_USER="dummy" + MSMTP_SMTP_PASS="dummy" +fi + +cat > /etc/msmtprc < ~/.rss2email/feeds.txt + +/app/rss2email daemon ${RECIPIENTS} \ No newline at end of file