An open API service indexing awesome lists of open source software.

https://github.com/alfiosalanitri/imapsync-docker

A minimal Docker image to synchronize emails between two IMAP mailboxes using imapsync
https://github.com/alfiosalanitri/imapsync-docker

docker imapsync sysadmin-tool

Last synced: 22 days ago
JSON representation

A minimal Docker image to synchronize emails between two IMAP mailboxes using imapsync

Awesome Lists containing this project

README

          

# imapsync-docker

πŸ› οΈ A minimal Docker image to synchronize emails between two IMAP mailboxes using `imapsync`.

Published on GitHub Container Registry:
πŸ‘‰ `ghcr.io/alfiosalanitri/imapsync-docker`

---

## πŸš€ Features

- Based on Alpine for a lightweight image
- Includes imapsync and required dependencies
- Simple `.env`-based configuration
- Ready for CI/CD with versioned tags

---

## πŸ“¦ Usage

```bash
cp .env.example .env
```

2. **Edit `.env` with your mailbox credentials**:

```ini
USER_1=user@host1.it
PASSWORD_1=yourpassword
HOST_1=imap.host1.it
SSL_1=yes

USER_2=user@host2.it
PASSWORD_2=yourpassword
HOST_2=imap.host2.it
SSL_2=yes
```

| Variable | Required | Description |
| ------------ | -------- | ------------------------------------- |
| `HOST_1` | βœ… | Source IMAP server hostname or IP |
| `USER_1` | βœ… | Source mailbox login |
| `PASSWORD_1` | βœ… | Source mailbox password |
| `SSL_1` | ❌ | Set to `yes` to enable SSL for source |
| `HOST_2` | βœ… | Target IMAP server hostname or IP |
| `USER_2` | βœ… | Target mailbox login |
| `PASSWORD_2` | βœ… | Target mailbox password |
| `SSL_2` | ❌ | Set to `yes` to enable SSL for target |

3. **Run**:

```bash
docker run --rm --env-file .env ghcr.io/alfiosalanitri/imapsync-docker:latest
```

### πŸ“ Usage Notes

When running on Arch Linux with rootless Docker, hostname resolution (e.g. mail.example.com) may not work due to systemd-resolved or DNS configuration in the user namespace.

βœ… As a workaround, use the server’s IP address instead of its DNS name in HOST_1 and HOST_2.

---

## πŸ› οΈ Build Locally

```bash
docker build -t imapsync-docker .
docker run --rm --env-file .env imapsync-docker
```

---

> Recommended for production use.

---

## 🧬 Release Workflow

1. Commit your changes.
2. Run the release script with a semver tag:

```bash
./release.sh v1.0.0
```

This will:
- Commit (if needed)
- Tag the commit
- Push the tag
- Trigger GitHub Actions to publish the image as:
- `ghcr.io/alfiosalanitri/imapsync-docker:v1.0.0`
- `...:latest`

---

## πŸ“ Files

- `Dockerfile`: Builds the imapsync container.
- `entrypoint.sh`: Sync logic.
- `.env.example`: Example env file.
- `release.sh`: Automates release & tagging.
- `.github/workflows/publish.yml`: Publishes images to GHCR.

---

## πŸ” Security Notes

Never commit your .env file.

For production use, consider using Docker secrets or environment injection tools.

---

## πŸ›  Built With

[imapsync](https://imapsync.lamiral.info/) – IMAP synchronization utility

[Alpine Linux](https://alpinelinux.org/) – small base image

[Docker Compose](https://docs.docker.com/compose/) – simple orchestration

---

## πŸ“œ License

This project is licensed under the MIT License β€” see the [LICENSE](./LICENSE) file for details.

---

## 🀝 Contributing

Feel free to open issues or submit pull requests to improve functionality, automation, or performance.

---

## πŸ’‘ Inspiration

Originally created to simplify email migrations and backups for developers and sysadmins using Docker.