26 lines
1.5 KiB
JavaScript
26 lines
1.5 KiB
JavaScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
test('release targets AMD64 and ARM64 with layout 7', () => {
|
|
const release = JSON.parse(readFileSync(new URL('../release.json', import.meta.url), 'utf8'));
|
|
assert.deepEqual(release.platforms, ['linux/amd64', 'linux/arm64']);
|
|
assert.equal(release.deployment_schema, 7);
|
|
});
|
|
|
|
test('Node and Caddy stages inherit the target platform', () => {
|
|
const dockerfile = readFileSync(new URL('./Dockerfile', import.meta.url), 'utf8');
|
|
const stages = dockerfile.split(String.fromCharCode(10)).filter(line => line.startsWith('FROM '));
|
|
assert.deepEqual(stages, ['FROM caddy:2.10.2 AS proxy', 'FROM node:24-bookworm-slim']);
|
|
assert.ok(dockerfile.includes('COPY --from=proxy /usr/bin/caddy /usr/bin/caddy'));
|
|
});
|
|
|
|
test('runtime includes Python tooling and headless LibreOffice with CJK fonts', () => {
|
|
const dockerfile = readFileSync(new URL('./Dockerfile', import.meta.url), 'utf8');
|
|
const install = dockerfile.split(String.fromCharCode(92, 10)).join(' ').split(String.fromCharCode(10)).find(line => line.startsWith('RUN apt-get update && apt-get install'));
|
|
for (const pkg of ['python3', 'python3-pip', 'python3-venv', 'python-is-python3', 'libreoffice', 'fonts-noto-cjk']) {
|
|
assert.ok(install.split(/\s+/).includes(pkg), `missing runtime package: ${pkg}`);
|
|
}
|
|
assert.ok(dockerfile.includes('RUN python --version && python3 -m pip --version && libreoffice --headless --version'));
|
|
});
|