File tree Expand file tree Collapse file tree 3 files changed +63
-2
lines changed
Expand file tree Collapse file tree 3 files changed +63
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+
3+ name : Create and publish a container image
4+
5+ on :
6+ push
7+
8+ env :
9+ REGISTRY : ghcr.io
10+ IMAGE_NAME : ${{ github.repository }}
11+ CADDY_VERSION : " 2.4.6"
12+
13+ jobs :
14+ build-and-push-image :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ packages : write
19+
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@v2
23+
24+ - name : Log in to the Container registry
25+ uses : docker/login-action@v1.12.0
26+ with :
27+ registry : ${{ env.REGISTRY }}
28+ username : ${{ github.actor }}
29+ password : ${{ secrets.GITHUB_TOKEN }}
30+
31+ - name : Extract metadata (tags, labels)
32+ id : meta
33+ uses : docker/metadata-action@v3.6.2
34+ with :
35+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36+
37+ - name : Build and push container image
38+ uses : docker/build-push-action@v2.9.0
39+ with :
40+ context : .
41+ file : ./Containerfile
42+ build-args : |
43+ CADDY_VERSION=${{ env.CADDY_VERSION }}
44+ push : true
45+ tags : ${{ steps.meta.outputs.tags }}
46+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change 1+ ARG CADDY_VERSION=latest
2+ FROM docker.io/library/caddy:${CADDY_VERSION}-builder AS builder
3+
4+ RUN xcaddy build
5+
6+ FROM docker.io/library/caddy:${CADDY_VERSION}
7+
8+ COPY --from=builder /usr/bin/caddy /usr/bin/caddy
Original file line number Diff line number Diff line change 11RUNTIME ?= podman
2+ CADDY_IMAGE ?= caddy-mpl
23CADDY_VERSION ?= 2.4.6
34
45serve :
89 -v $$ PWD/Caddyfile:/etc/caddy/Caddyfile:ro,Z \
910 -e SITE_DIR=/srv \
1011 -p 2015:2015 \
11- docker.io/library/caddy :$(CADDY_VERSION ) \
12+ $( CADDY_IMAGE ) :$(CADDY_VERSION ) \
1213 caddy run --config /etc/caddy/Caddyfile --watch
1314
15+ image :
16+ $(RUNTIME ) build \
17+ --build-arg=CADDY_VERSION=$(CADDY_VERSION ) \
18+ -t $(CADDY_IMAGE ) :$(CADDY_VERSION ) \
19+ -f Containerfile
20+
1421fmt :
1522 $(RUNTIME ) run --rm -it \
1623 -v $$ PWD/Caddyfile:/etc/caddy/Caddyfile:Z \
17- docker.io/library/caddy :$(CADDY_VERSION ) \
24+ $( CADDY_IMAGE ) :$(CADDY_VERSION ) \
1825 caddy fmt --overwrite /etc/caddy/Caddyfile
You can’t perform that action at this time.
0 commit comments