Merge pull request #2 from christianlouis/copilot/add-docker-container-setup

Add GitHub Actions for automated Docker container builds
This commit is contained in:
Christian Krakau-Louis
2026-02-01 13:40:28 +01:00
committed by GitHub
3 changed files with 135 additions and 1 deletions
+74
View File
@@ -0,0 +1,74 @@
name: Build and Push Docker Image
on:
push:
branches:
- main
- master
tags:
- 'v*'
pull_request:
branches:
- main
- master
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
id: build
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
- name: Generate artifact attestation
if: github.event_name != 'pull_request'
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true
+57 -1
View File
@@ -22,7 +22,39 @@ A Docker-based solution that automatically fetches emails from POP3 mailboxes an
- POP3 account credentials
- (Optional) Postmarkapp account for error notifications
### Setup
### Option 1: Using Pre-built Docker Image (Recommended)
The Docker images are automatically built and published to GitHub Container Registry.
1. **Create configuration file**
```bash
# Download the docker-compose.yml and .env.example
curl -O https://raw.githubusercontent.com/christianlouis/pop_puller_to_gmail/main/docker-compose.yml
curl -o .env https://raw.githubusercontent.com/christianlouis/pop_puller_to_gmail/main/.env.example
# Edit .env with your credentials
nano .env
```
2. **Update docker-compose.yml to use the pre-built image**
```yaml
version: '3.8'
services:
pop3-forwarder:
image: ghcr.io/christianlouis/pop_puller_to_gmail:latest
container_name: pop3-gmail-forwarder
restart: unless-stopped
env_file:
- .env
```
3. **Run the container**
```bash
docker-compose up -d
```
### Option 2: Building from Source
1. **Clone the repository**
```bash
@@ -69,6 +101,30 @@ A Docker-based solution that automatically fetches emails from POP3 mailboxes an
docker-compose logs -f
```
## Using Pre-built Docker Images
Docker images are automatically built and published to GitHub Container Registry for every release and commit to the main branch.
### Available Image Tags
- `ghcr.io/christianlouis/pop_puller_to_gmail:latest` - Latest build from main branch
- `ghcr.io/christianlouis/pop_puller_to_gmail:v1.0.0` - Specific version tags
- `ghcr.io/christianlouis/pop_puller_to_gmail:main` - Main branch builds
### Pull and Run
```bash
# Pull the latest image
docker pull ghcr.io/christianlouis/pop_puller_to_gmail:latest
# Run directly with Docker
docker run -d \
--name pop3-forwarder \
--env-file .env \
--restart unless-stopped \
ghcr.io/christianlouis/pop_puller_to_gmail:latest
```
## Configuration
### POP3 Accounts
+4
View File
@@ -2,7 +2,11 @@ version: '3.8'
services:
pop3-forwarder:
# Option 1: Build from source (default)
build: .
# Option 2: Use pre-built image from GitHub Container Registry
# Uncomment the line below and comment out 'build: .' to use pre-built image
# image: ghcr.io/christianlouis/pop_puller_to_gmail:latest
container_name: pop3-gmail-forwarder
restart: unless-stopped
env_file: