-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile.j2
More file actions
91 lines (75 loc) · 3.1 KB
/
Containerfile.j2
File metadata and controls
91 lines (75 loc) · 3.1 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# AdGuardHome Sync - Configuration Sync Tool
# Multi-stage build
ARG BASE_VERSION=15
FROM ghcr.io/daemonless/base:${BASE_VERSION} AS builder
# Install build dependencies
RUN pkg update && pkg install -y go125 git ca_root_nss
ARG UPSTREAM_URL="https://api.github.com/repos/bakito/adguardhome-sync/releases/latest"
# Build from source
RUN mkdir -p /app && \
VERSION=$(fetch -qo - "${UPSTREAM_URL}" | jq -r '.tag_name') && \
echo "Building AdGuardHome Sync ${VERSION}" && \
git clone --depth 1 --branch "${VERSION}" https://github.com/bakito/adguardhome-sync.git /tmp/src && \
cd /tmp/src && \
CGO_ENABLED=0 /usr/local/bin/go125 build -ldflags="-s -w -X github.com/bakito/adguardhome-sync/version.Version=${VERSION}" -o /usr/local/bin/adguardhome-sync . && \
echo "${VERSION}" > /app/version
# Production image
FROM ghcr.io/daemonless/base:${BASE_VERSION}
ARG FREEBSD_ARCH=amd64
ARG PACKAGES="ca_root_nss"
ARG UPSTREAM_URL="https://api.github.com/repos/bakito/adguardhome-sync/releases/latest"
ARG UPSTREAM_JQ=".tag_name"
{%- if ports %}
ARG HEALTHCHECK_ENDPOINT="http://localhost:{{ ports[0].port }}"
{%- else %}
ARG HEALTHCHECK_ENDPOINT="http://localhost:8080"
{%- endif %}
ENV HEALTHCHECK_URL="${HEALTHCHECK_ENDPOINT}"
# --- Metadata (Injected by Generator) ---
LABEL org.opencontainers.image.title="{{ title }}" \
org.opencontainers.image.description="{{ description }}" \
org.opencontainers.image.source="{{ repo_url }}" \
org.opencontainers.image.url="{{ web_url }}" \
org.opencontainers.image.documentation="https://github.com/bakito/adguardhome-sync" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.vendor="daemonless" \
org.opencontainers.image.authors="daemonless" \
io.daemonless.category="{{ category }}" \
{%- if ports %}
io.daemonless.port="{{ ports[0].port }}" \
{%- endif %}
{%- if volumes %}
io.daemonless.volumes="{{ volumes | map(attribute='path') | join(',') }}" \
{%- endif %}
{%- if mlock %}
org.freebsd.jail.allow.mlock="required" \
{%- endif %}
io.daemonless.arch="${FREEBSD_ARCH}" \
io.daemonless.upstream-url="${UPSTREAM_URL}" \
io.daemonless.upstream-jq="${UPSTREAM_JQ}" \
io.daemonless.healthcheck-url="${HEALTHCHECK_ENDPOINT}" \
io.daemonless.packages="${PACKAGES}"
# Install runtime dependencies
RUN pkg update && \
pkg install -y ${PACKAGES} && \
pkg clean -ay && \
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
# Copy binary
COPY --from=builder /usr/local/bin/adguardhome-sync /usr/local/bin/adguardhome-sync
COPY --from=builder /app/version /app/version
RUN chmod 755 /usr/local/bin/adguardhome-sync
# Create config directory
RUN mkdir -p /config && \
chown -R bsd:bsd /config
# Copy service definition
COPY root/ /
# Make scripts executable
RUN chmod +x /etc/services.d/*/run /etc/cont-init.d/* 2>/dev/null || true
# --- Expose (Injected by Generator) ---
{%- if ports %}
EXPOSE {{ ports | map(attribute='port') | join(' ') }}
{%- endif %}
# --- Volumes (Injected by Generator) ---
{%- if volumes %}
VOLUME {{ volumes | map(attribute='path') | join(' ') }}
{%- endif %}