-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
65 lines (54 loc) · 2.68 KB
/
Copy pathContainerfile
File metadata and controls
65 lines (54 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# --------------------------------------------------------------------------
# THIS FILE IS AUTOGENERATED - DO NOT EDIT MANUALLY
#
# Source: Containerfile.j2
# --------------------------------------------------------------------------
ARG BASE_VERSION=15.1
FROM ghcr.io/daemonless/base:${BASE_VERSION}
ARG FREEBSD_ARCH=amd64
ARG PACKAGES="ca_root_nss"
ARG UPSTREAM_URL="https://api.github.com/repos/caddyserver/caddy/releases/latest"
ARG UPSTREAM_JQ=".tag_name"
LABEL org.opencontainers.image.title="Caddy" \
org.opencontainers.image.description="Fast, multi-platform web server and reverse proxy with automatic HTTPS, written in Go." \
org.opencontainers.image.source="https://github.com/daemonless/caddy" \
org.opencontainers.image.url="https://caddyserver.com" \
org.opencontainers.image.documentation="https://caddyserver.com/docs/" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.vendor="daemonless" \
org.opencontainers.image.authors="daemonless" \
io.daemonless.category="Network" \
io.daemonless.port="80" \
io.daemonless.volumes="/config,/data" \
io.daemonless.arch="${FREEBSD_ARCH}" \
io.daemonless.upstream-url="${UPSTREAM_URL}" \
io.daemonless.upstream-jq="${UPSTREAM_JQ}" \
io.daemonless.packages="${PACKAGES}"
# Install ca_root_nss for HTTPS/ACME
RUN pkg update && \
pkg install -y ${PACKAGES} && \
pkg clean -ay && \
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
# Download and install the official Caddy FreeBSD binary
# Release asset uses Go arch naming (aarch64 -> arm64) and a v-less version.
RUN CADDY_VERSION=$(fetch -qo - "${UPSTREAM_URL}" | jq -r "${UPSTREAM_JQ}") && \
FN_VERSION=${CADDY_VERSION#v} && \
case "${FREEBSD_ARCH}" in aarch64) CADDY_ARCH=arm64 ;; *) CADDY_ARCH=${FREEBSD_ARCH} ;; esac && \
echo "Installing Caddy ${CADDY_VERSION} (freebsd_${CADDY_ARCH})" && \
fetch -qo /tmp/caddy.tar.gz "https://github.com/caddyserver/caddy/releases/download/${CADDY_VERSION}/caddy_${FN_VERSION}_freebsd_${CADDY_ARCH}.tar.gz" && \
mkdir -p /usr/local/bin && \
tar xzf /tmp/caddy.tar.gz -C /usr/local/bin caddy && \
chmod +x /usr/local/bin/caddy && \
mkdir -p /app && echo "$CADDY_VERSION" > /app/version && \
rm /tmp/caddy.tar.gz
# Create directories (certs/ACME state land in /data)
RUN mkdir -p /config /data && \
chown -R bsd:bsd /config /data
COPY root/ /
RUN chmod +x /etc/services.d/caddy/run /etc/cont-init.d/* 2>/dev/null || true
RUN mkdir -p /run/s6/services/caddy && \
ln -sf /etc/services.d/caddy/run /run/s6/services/caddy/run
# Expose (443/udp = HTTP/3; 2019 = admin API, localhost only)
EXPOSE 80 443 2019
# Volumes
VOLUME /config /data