|
| 1 | +title: dockerized-imap-sync |
| 2 | +type: DevOps / Email |
| 3 | +year: 2026 |
| 4 | +technologies: Docker, imapsync, Shell, GitHub Actions, GHCR, cron |
| 5 | + |
| 6 | +# dockerized-imap-sync |
| 7 | + |
| 8 | +## Continuous IMAP Mailbox Sync in a Single Container |
| 9 | + |
| 10 | +dockerized-imap-sync is a standalone Docker container that runs `imapsync` on a 3-minute cron schedule to continuously mirror one IMAP mailbox to another. It reproduces the behavior of a Kubernetes `CronJob` without requiring a cluster — just a single `docker run`. |
| 11 | + |
| 12 | +## Why It Exists |
| 13 | +- Drop-in replacement for the `imap-cron.yml` Kubernetes CronJob for environments that don't have a cluster. |
| 14 | +- Fully self-contained: no external scheduler, no orchestrator dependency. |
| 15 | +- Environment-variable-driven — swap source or destination without rebuilding the image. |
| 16 | + |
| 17 | +## Configuration |
| 18 | + |
| 19 | +All credentials are passed as runtime environment variables: |
| 20 | + |
| 21 | +| Variable | Description | |
| 22 | +|---|---| |
| 23 | +| `IMAP1_HOST` | Source IMAP server (default: `imap.mail.yahoo.com`) | |
| 24 | +| `IMAP1_USER` | Source mailbox username | |
| 25 | +| `IMAP1_PASSWORD` | Source mailbox password | |
| 26 | +| `IMAP2_HOST` | Destination IMAP server (default: `imap.gmail.com`) | |
| 27 | +| `IMAP2_USER` | Destination mailbox username | |
| 28 | +| `IMAP2_PASSWORD` | Destination mailbox password | |
| 29 | + |
| 30 | +Defaults are baked in for Yahoo and Gmail hosts, but all variables should be passed explicitly at runtime. |
| 31 | + |
| 32 | +## Usage |
| 33 | + |
| 34 | +```bash |
| 35 | +docker run -d \ |
| 36 | + --name dockerized-imap-sync \ |
| 37 | + -e IMAP1_HOST='imap.mail.yahoo.com' \ |
| 38 | + -e IMAP1_USER='your-source-user' \ |
| 39 | + -e IMAP1_PASSWORD='your-source-password' \ |
| 40 | + -e IMAP2_HOST='imap.gmail.com' \ |
| 41 | + -e IMAP2_USER='your-destination-user' \ |
| 42 | + -e IMAP2_PASSWORD='your-destination-password' \ |
| 43 | + dockerized-imap-sync |
| 44 | +``` |
| 45 | + |
| 46 | +## Behavior |
| 47 | +- `imapsync` runs every 3 minutes via an internal cron job |
| 48 | +- Fails fast if any required environment variable is missing at startup |
| 49 | +- Sync flags mirror the original Kubernetes job exactly for behavioral parity |
| 50 | + |
| 51 | +## CI/CD |
| 52 | + |
| 53 | +The repository includes a GitHub Actions workflow that builds and pushes the image to GHCR on every push to `main` and on manual dispatch. |
| 54 | + |
| 55 | +Published tags: |
| 56 | +- `ghcr.io/<owner>/dockerized-imap-sync:latest` |
| 57 | +- `ghcr.io/<owner>/dockerized-imap-sync:sha-<commit>` |
| 58 | + |
| 59 | +## Status |
| 60 | +- **State:** Active, publicly available. |
| 61 | +- **Role:** Full design and implementation (container, cron setup, CI/CD pipeline). |
| 62 | + |
| 63 | +[GitHub](https://github.com/javaDevJT/dockerized-imap-sync) |
0 commit comments