Skip to content

Commit

Permalink
feat: add dockerfile with github workflow to rebuild
Browse files Browse the repository at this point in the history
ci: hopefully fix workflow
  • Loading branch information
jasonraimondi committed Dec 10, 2024
1 parent b279a29 commit 32fb7dc
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/rebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Rebuild Caddy Git

on:
push:
branches:
- main
paths:
- '.github/workflows/rebuild.yml'
- 'Dockerfile'
- 'Caddyfile'
schedule:
- cron: "20 */4 * * *"
workflow_dispatch: # Allow manual triggering

jobs:
rebuild-caddy:
name: Rebuild and Push Caddy Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/caddy
tags: |
type=raw,value=latest
type=sha,prefix={{date 'YYYYMMDDHHmmss'}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
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
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM caddy:2-alpine

RUN apk add --no-cache nss-tools
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
# dockerfile-caddy

```yml
services:
caddy:
build: .
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- ./certs:/certs:ro
- caddy_data:/data
- caddy_config:/config

volumes:
caddy_data:
caddy_config:
```

0 comments on commit 32fb7dc

Please sign in to comment.