-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
80 lines (64 loc) · 2.89 KB
/
Containerfile
File metadata and controls
80 lines (64 loc) · 2.89 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
# --------------------------------------------------------------------------
# THIS FILE IS AUTOGENERATED - DO NOT EDIT MANUALLY
#
# Source: Containerfile.j2
# --------------------------------------------------------------------------
ARG BASE_VERSION=15
ARG UPSTREAM_URL="https://api.github.com/repos/rustmailer/bichon/releases/latest"
ARG UPSTREAM_JQ=".tag_name"
# --- Backend Builder Stage ---
FROM ghcr.io/daemonless/base:${BASE_VERSION} AS builder
ARG FREEBSD_ARCH=amd64
ARG BUILD_PACKAGES="rust pkgconf git-lite FreeBSD-toolchain FreeBSD-openssl-dev zstd FreeBSD-set-devel cmake"
# Install build dependencies
RUN pkg update && \
pkg install -y ${BUILD_PACKAGES}
# Clone Bichon (fetching the latest tag)
WORKDIR /build
RUN BICHON_TAG=$(git ls-remote --tags --sort="v:refname" https://github.com/rustmailer/bichon.git | tail -n1 | sed 's/.*\///') && \
echo "Building tag: ${BICHON_TAG}" && \
git clone --depth 1 -b "${BICHON_TAG}" https://github.com/rustmailer/bichon.git . && \
echo "${BICHON_TAG}" > /build/version
# Note: Frontend build (web/dist) is built on Linux in the build-web CI job
# and passed as an artifact to this stage. SWC is not available on FreeBSD.
# This folder is embedded into the Rust binary at compile time.
COPY web/dist /build/web/dist
# Build Backend
RUN cargo build --release --bin bichon --bin bichonctl --bin bichon-admin
# --- Runtime Stage ---
FROM ghcr.io/daemonless/base:${BASE_VERSION}
ARG FREEBSD_ARCH=amd64
ARG PACKAGES="FreeBSD-openssl zstd curl"
# --- Metadata (Injected by Generator) ---
LABEL org.opencontainers.image.title="Bichon" \
org.opencontainers.image.description="A lightweight, high-performance Rust email archiver with WebUI." \
org.opencontainers.image.source="https://github.com/daemonless/bichon" \
org.opencontainers.image.url="https://github.com/rustmailer/bichon" \
org.opencontainers.image.licenses="GPL-3.0-only" \
org.opencontainers.image.vendor="daemonless" \
org.opencontainers.image.authors="daemonless" \
io.daemonless.category="Utilities" \
io.daemonless.port="15630" \
io.daemonless.arch="${FREEBSD_ARCH}" \
io.daemonless.upstream-url="${UPSTREAM_URL}" \
io.daemonless.upstream-jq="${UPSTREAM_JQ}"
# Install runtime dependencies
RUN pkg update && \
pkg install -y ${PACKAGES} && \
pkg clean -ay && \
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
# Copy binaries and version from builder
COPY --from=builder /build/version /app/version
COPY --from=builder /build/target/release/bichon /usr/local/bin/
COPY --from=builder /build/target/release/bichonctl /usr/local/bin/
COPY --from=builder /build/target/release/bichon-admin /usr/local/bin/
# Copy root filesystem
COPY root/ /
# Set permissions
RUN chmod +x /etc/services.d/bichon/run /healthz && \
mkdir -p /data
# Working directory for Bichon
WORKDIR /data
VOLUME /data
# --- Expose (Injected by Generator) ---
EXPOSE 15630