-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dockerfile with github workflow to rebuild
ci: hopefully fix workflow
- Loading branch information
1 parent
b279a29
commit 32fb7dc
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
``` |