-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
78 lines (66 loc) · 3.09 KB
/
Copy pathContainerfile
File metadata and controls
78 lines (66 loc) · 3.09 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
# --------------------------------------------------------------------------
# THIS FILE IS AUTOGENERATED - DO NOT EDIT MANUALLY
#
# Source: Containerfile.j2
# --------------------------------------------------------------------------
# Stage 1: Build playwright-core from ports
ARG BASE_VERSION=15-pkg
FROM ghcr.io/daemonless/base-core:${BASE_VERSION} AS builder
# Install build deps + runtime deps (RUN_DEPENDS)
RUN pkg update && \
pkg install -y node24 npm-node24 chromium ffmpeg FreeBSD-bmake git-tiny && \
pkg clean -ay && \
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
# FreeBSD ports Mk infrastructure
RUN git clone --depth 1 --no-checkout --filter=blob:none \
https://git.FreeBSD.org/ports.git /usr/ports && \
cd /usr/ports && \
git sparse-checkout set Mk Templates Tools Keywords && \
git checkout
# Our port
RUN git clone --depth 1 --no-checkout --filter=blob:none \
https://github.com/daemonless/freebsd-ports.git /tmp/daemonless-ports && \
cd /tmp/daemonless-ports && \
git sparse-checkout set www/playwright-core && \
git checkout && \
cp -r /tmp/daemonless-ports/www /usr/ports/www
# Build and package
RUN cd /usr/ports/www/playwright-core && \
make -DBATCH OSVERSION=$(uname -K) WRKDIRPREFIX=/tmp/wrkdirs package && \
find /tmp/wrkdirs -name "playwright-core-*.pkg" | head -1 | xargs -I{} cp {} /playwright-core.pkg && \
rm -rf /tmp/daemonless-ports /tmp/wrkdirs
# Stage 2: Runtime image
ARG BASE_VERSION=15-pkg
FROM ghcr.io/daemonless/base-core:${BASE_VERSION}
ARG FREEBSD_ARCH=amd64
ARG PACKAGES="chromium ffmpeg dejavu noto-basic ca_root_nss node24"
ARG UPSTREAM_URL="https://registry.npmjs.org/playwright-core/latest"
# --- Metadata (Injected by Generator) ---
LABEL org.opencontainers.image.title="Playwright" \
org.opencontainers.image.description="Playwright (Chromium) on FreeBSD. Use as a base image for running browser tests." \
org.opencontainers.image.source="https://github.com/daemonless/playwright" \
org.opencontainers.image.url="https://playwright.dev/" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.vendor="daemonless" \
org.opencontainers.image.authors="daemonless" \
io.daemonless.category="Utilities" \
io.daemonless.arch="${FREEBSD_ARCH}" \
io.daemonless.pkg-source="ports" \
io.daemonless.upstream-url="${UPSTREAM_URL}" \
io.daemonless.upstream-jq=".version"
# Install runtime deps then playwright-core from ports build
COPY --from=builder /playwright-core.pkg /playwright-core.pkg
RUN pkg update && \
pkg install -y ${PACKAGES} /playwright-core.pkg && \
rm /playwright-core.pkg && \
pkg clean -ay && \
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
# chmod so USER bsd can read it for version extraction
RUN mkdir -p /app && \
pkg query '%v' playwright-core > /app/version && \
chmod 755 /app && chmod 644 /app/version
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 \
PLAYWRIGHT_BROWSERS_PATH=/usr/local/libexec/ms-playwright \
PLAYWRIGHT_HOST_PLATFORM_OVERRIDE=freebsd-amd64 \
NODE_PATH=/usr/local/lib/node_modules
USER bsd