File tree 3 files changed +63
-2
lines changed
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
+
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
+
34
+ with :
35
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36
+
37
+ - name : Build and push container image
38
+
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 1
1
RUNTIME ?= podman
2
+ CADDY_IMAGE ?= caddy-mpl
2
3
CADDY_VERSION ?= 2.4.6
3
4
4
5
serve :
8
9
-v $$ PWD/Caddyfile:/etc/caddy/Caddyfile:ro,Z \
9
10
-e SITE_DIR=/srv \
10
11
-p 2015:2015 \
11
- docker.io/library/caddy :$(CADDY_VERSION ) \
12
+ $( CADDY_IMAGE ) :$(CADDY_VERSION ) \
12
13
caddy run --config /etc/caddy/Caddyfile --watch
13
14
15
+ image :
16
+ $(RUNTIME ) build \
17
+ --build-arg=CADDY_VERSION=$(CADDY_VERSION ) \
18
+ -t $(CADDY_IMAGE ) :$(CADDY_VERSION ) \
19
+ -f Containerfile
20
+
14
21
fmt :
15
22
$(RUNTIME ) run --rm -it \
16
23
-v $$ PWD/Caddyfile:/etc/caddy/Caddyfile:Z \
17
- docker.io/library/caddy :$(CADDY_VERSION ) \
24
+ $( CADDY_IMAGE ) :$(CADDY_VERSION ) \
18
25
caddy fmt --overwrite /etc/caddy/Caddyfile
You can’t perform that action at this time.
0 commit comments