Initial commit
All checks were successful
Build Docker image / Build image (push) Successful in 3m46s
All checks were successful
Build Docker image / Build image (push) Successful in 3m46s
This commit is contained in:
commit
784b8de840
3 changed files with 79 additions and 0 deletions
62
.forgejo/workflows/build.yaml
Normal file
62
.forgejo/workflows/build.yaml
Normal file
|
@ -0,0 +1,62 @@
|
|||
name: Build Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
schedule:
|
||||
- cron: "0 12 * * *"
|
||||
|
||||
jobs:
|
||||
build_image:
|
||||
name: Build image
|
||||
runs-on: docker
|
||||
if: env.SCHEDULED == 'true' || !contains(github.event.commits[0].message, '[skip ci]')
|
||||
|
||||
env:
|
||||
VERSION: 2.7
|
||||
SCHEDULED: ${{ github.event_name == 'schedule' }}
|
||||
PUSHED: ${{ github.event_name == 'push' }}
|
||||
REGISTRY: git.korhonen.cc
|
||||
REPO: ${{ env.REGISTRY }}/functionalhacker/caddy
|
||||
|
||||
steps:
|
||||
- name: Check if update available
|
||||
if: env.SCHEDULED == 'true'
|
||||
id: check
|
||||
uses: https://github.com/ClementTsang/docker-check-base-image-diff@v0.0.2
|
||||
with:
|
||||
base-image: docker://caddy:${{ env.VERSION }}
|
||||
derived-image: docker://${{ env.REPO }}:latest
|
||||
|
||||
- name: Check result
|
||||
if: env.SCHEDULED == 'true'
|
||||
run: echo "Needs updating = ${{ steps.check.outputs.differs }}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
if: env.PUSHED == 'true' || steps.check.outputs.differs == 'true'
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker registry
|
||||
if: env.PUSHED == 'true' || steps.check.outputs.differs == 'true'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Get point release
|
||||
id: point_release
|
||||
if: env.PUSHED == 'true' || steps.check.outputs.differs == 'true'
|
||||
run: |
|
||||
VERSION="$(skopeo list-tags docker://caddy | jq -r '[.Tags[] | select(test("^${{ VERSION }}.[0-9]$"))] | last')"
|
||||
echo "Point release: $VERSION"
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push image
|
||||
if: env.PUSHED == 'true' || steps.check.outputs.differs == 'true'
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
build-args: VERSION=${{ env.VERSION }}
|
||||
tags: |
|
||||
${{ env.REPO }}:latest
|
||||
${{ env.REPO }}:${{ env.VERSION }}
|
11
Dockerfile
Normal file
11
Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
|||
ARG VERSION
|
||||
|
||||
FROM caddy:${VERSION}-builder AS builder
|
||||
|
||||
RUN xcaddy build \
|
||||
--with github.com/caddy-dns/cloudflare \
|
||||
--with github.com/simia-tech/caddy-locale
|
||||
|
||||
FROM caddy:${VERSION}
|
||||
|
||||
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
|
6
README.adoc
Normal file
6
README.adoc
Normal file
|
@ -0,0 +1,6 @@
|
|||
== My Caddy build
|
||||
|
||||
This is the Caddy build I use on my server. It contains these modules
|
||||
|
||||
* link:https://github.com/caddy-dns/cloudflare[Cloudflare DNS]
|
||||
* link:https://github.com/simia-tech/caddy-locale[Locale]
|
Loading…
Reference in a new issue