v1.0.01 - docker

This commit is contained in:
Martin Krivosija
2025-03-31 23:32:29 +02:00
parent 78a1527730
commit ccc9eb1181
3 changed files with 80 additions and 11 deletions
+35
View File
@@ -0,0 +1,35 @@
name: Docker
on:
push:
branches: [ main ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log into registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}
+27
View File
@@ -0,0 +1,27 @@
ARG NODE_VERSION=22.13.1
ARG VERSION
FROM node:${NODE_VERSION}-alpine
ENV NODE_ENV="production" \
PORT="2525" \
UMASK="0002" \
TZ="Etc/UTC"
WORKDIR /app
RUN apk add --no-cache --virtual=.build-deps git \
&& git clone https://github.com/softbounce/inbound-email.git . \
&& if [ -n "${VERSION}" ]; then \
NUMBER_COMMITS_TO_REVERT=$(( $(git rev-list --count --first-parent HEAD) - $(echo "${VERSION}" | cut -d "." -f3) )); \
git checkout "master~${NUMBER_COMMITS_TO_REVERT}"; \
fi \
&& npm install --omit=dev \
&& chown -R root:root /app && chmod -R 755 /app \
&& apk del --purge .build-deps \
&& rm -rf /root/.cache /root/.cargo /tmp/*
USER node
EXPOSE 2525
CMD node server.js
LABEL org.opencontainers.image.source="https://github.com/softbounce/inbound-email"
+18 -11
View File
@@ -1,6 +1,6 @@
# Inbound Email (SMTP) to Webhook # Inbound Email (SMTP) to Webhook
Author: [Martin Alexander](https://martinalexander.me/) - [LinkedIn](https://www.linkedin.com/in/martin-alexander) Author: Martin Krivosija - [LinkedIn](https://linkedin.com/in/martin-alexander-k)
A simple, efficient script that provides an SMTP server to receive emails, parse content (including headers), store attachments in Amazon S3, and forward email content to a webhook. Graceful handling of multiple concurrent SMTP sessions and webhook requests. A simple, efficient script that provides an SMTP server to receive emails, parse content (including headers), store attachments in Amazon S3, and forward email content to a webhook. Graceful handling of multiple concurrent SMTP sessions and webhook requests.
@@ -24,7 +24,7 @@ A simple, efficient script that provides an SMTP server to receive emails, parse
1. Clone this repository: 1. Clone this repository:
``` ```
git clone https://github.com/sendbetter/inbound-email.git git clone https://github.com/kriiv/inbound-email.git
cd inbound-email cd inbound-email
``` ```
@@ -34,15 +34,22 @@ A simple, efficient script that provides an SMTP server to receive emails, parse
``` ```
3. Copy the `.env.example` file to `.env` and set the required configuration: (eg. `mv .env.example .env`) 3. Copy the `.env.example` file to `.env` and set the required configuration: (eg. `mv .env.example .env`)
- `MAX_FILE_SIZE`: Maximum size of attachments to process, in bytes (default: 5MB)
- `AWS_REGION`: Your AWS region | Variable | Description | Required | Default |
- `AWS_ACCESS_KEY_ID`: Your AWS access key ID | --------------------- | --------------------------------------------------------------- | -------- | ----------- |
- `AWS_SECRET_ACCESS_KEY`: Your AWS secret access key | `WEBHOOK_URL` | The URL where parsed emails will be sent | Yes | `null` |
- `S3_BUCKET_NAME`: The name of your S3 bucket for storing attachments | `PORT` | The port for the SMTP server to listen on | No | `25` |
- `PORT`: The port for the SMTP server to listen on (default: 25) | `SMTP_SECURE` | Set to 'true' for TLS support (requires key/cert setup) | No | `false` |
- `WEBHOOK_URL`: The URL where parsed emails will be sent (required) | `WEBHOOK_CONCURRENCY` | Number of concurrent webhook requests | No | `5` |
- `SMTP_SECURE`: Set to 'true' for TLS support (default: false) | `MAX_FILE_SIZE` | Maximum attachment size in bytes (0 to disable S3 uploads) | No | `5242880` (5MB) |
- `WEBHOOK_CONCURRENCY`: Number of concurrent webhook requests (default: 5) | `AWS_REGION` | Your AWS region | If saving| `null` |
| `AWS_ACCESS_KEY_ID` | Your AWS access key ID | If saving| `null` |
| `AWS_SECRET_ACCESS_KEY`| Your AWS secret access key | If saving| `null` |
| `S3_BUCKET_NAME` | The name of your S3 bucket for storing attachments | If saving| `null` |
| `TLS_KEY_PATH` | Path to the TLS private key file (if `SMTP_SECURE=true`) | If secure| `null` |
| `TLS_CERT_PATH` | Path to the TLS certificate file (if `SMTP_SECURE=true`) | If secure| `null` |
*Note: S3 credentials (`AWS_*`, `S3_BUCKET_NAME`) are required if `MAX_FILE_SIZE` > 0.*
## Usage ## Usage