Files
jellytau/build/build-builder-image.html
T

365 lines
24 KiB
HTML

<!DOCTYPE HTML>
<html lang="en" class="navy" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Builder Image - JellyTau Documentation</title>
<!-- Custom HTML head -->
<meta name="description" content="Requirements, traceability, and architecture for the JellyTau Jellyfin client.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="../favicon.svg">
<link rel="shortcut icon" href="../favicon.png">
<link rel="stylesheet" href="../css/variables.css">
<link rel="stylesheet" href="../css/general.css">
<link rel="stylesheet" href="../css/chrome.css">
<link rel="stylesheet" href="../css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="../FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="../fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="../highlight.css">
<link rel="stylesheet" href="../tomorrow-night.css">
<link rel="stylesheet" href="../ayu-highlight.css">
<!-- Custom theme stylesheets -->
</head>
<body class="sidebar-visible no-js">
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "../";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "navy";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('navy')
html.classList.add(theme);
var body = document.querySelector('body');
body.classList.remove('no-js')
body.classList.add('js');
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var body = document.querySelector('body');
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
body.classList.remove('sidebar-visible');
body.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded affix "><a href="../index.html">Introduction</a></li><li class="chapter-item expanded affix "><li class="part-title">Requirements & Traceability</li><li class="chapter-item expanded "><a href="../requirements.html"><strong aria-hidden="true">1.</strong> Requirements Specification</a></li><li class="chapter-item expanded "><a href="../traceability.html"><strong aria-hidden="true">2.</strong> Traceability Matrix</a></li><li class="chapter-item expanded "><a href="../traceability-ci.html"><strong aria-hidden="true">3.</strong> Traceability CI</a></li><li class="chapter-item expanded "><a href="../traces-quick-ref.html"><strong aria-hidden="true">4.</strong> Traces Quick Reference</a></li><li class="chapter-item expanded affix "><li class="part-title">Architecture</li><li class="chapter-item expanded "><a href="../architecture/index.html"><strong aria-hidden="true">5.</strong> Overview</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../architecture/01-rust-backend.html"><strong aria-hidden="true">5.1.</strong> Rust Backend</a></li><li class="chapter-item "><a href="../architecture/02-svelte-frontend.html"><strong aria-hidden="true">5.2.</strong> Svelte Frontend</a></li><li class="chapter-item "><a href="../architecture/03-data-flow.html"><strong aria-hidden="true">5.3.</strong> Data Flow</a></li><li class="chapter-item "><a href="../architecture/04-type-sync-and-threading.html"><strong aria-hidden="true">5.4.</strong> Type Sync & Threading</a></li><li class="chapter-item "><a href="../architecture/05-platform-backends.html"><strong aria-hidden="true">5.5.</strong> Platform Backends</a></li><li class="chapter-item "><a href="../architecture/06-downloads-and-offline.html"><strong aria-hidden="true">5.6.</strong> Downloads & Offline</a></li><li class="chapter-item "><a href="../architecture/07-connectivity.html"><strong aria-hidden="true">5.7.</strong> Connectivity</a></li><li class="chapter-item "><a href="../architecture/08-database-design.html"><strong aria-hidden="true">5.8.</strong> Database Design</a></li><li class="chapter-item "><a href="../architecture/09-security.html"><strong aria-hidden="true">5.9.</strong> Security</a></li></ol></li><li class="chapter-item expanded "><li class="part-title">UX</li><li class="chapter-item expanded "><a href="../ux-flows.html"><strong aria-hidden="true">6.</strong> UX Flows</a></li><li class="chapter-item expanded affix "><li class="part-title">Specs — Pending Work</li><li class="chapter-item expanded "><a href="../specs/index.html"><strong aria-hidden="true">7.</strong> Specs Index</a></li><li class="chapter-item expanded "><a href="../specs/SPEC-TEMPLATE.html"><strong aria-hidden="true">8.</strong> Spec Template</a></li><li class="chapter-item expanded "><a href="../specs/SPEC-REVIEW-CHECKLIST.html"><strong aria-hidden="true">9.</strong> Spec Review Checklist</a></li><li class="chapter-item expanded "><a href="../specs/playback-backend-unification.html"><strong aria-hidden="true">10.</strong> Playback Backend Unification</a></li><li class="chapter-item expanded "><a href="../specs/linux-native-video-spike.html"><strong aria-hidden="true">11.</strong> Linux Native Video Spike</a></li><li class="chapter-item expanded "><a href="../specs/backend-owned-stream-selection.html"><strong aria-hidden="true">12.</strong> Backend-Owned Stream Selection</a></li><li class="chapter-item expanded "><a href="../specs/player-facade-enforcement.html"><strong aria-hidden="true">13.</strong> Player Facade Enforcement</a></li><li class="chapter-item expanded "><a href="../specs/windows-native-audio-backend.html"><strong aria-hidden="true">14.</strong> Windows Native Audio Backend</a></li><li class="chapter-item expanded "><a href="../specs/libmpv2-migration.html"><strong aria-hidden="true">15.</strong> libmpv2 Migration</a></li><li class="chapter-item expanded "><a href="../specs/read-through-media-cache.html"><strong aria-hidden="true">16.</strong> Read-Through Media Cache</a></li><li class="chapter-item expanded "><a href="../specs/scoped-search.html"><strong aria-hidden="true">17.</strong> Scoped Search</a></li><li class="chapter-item expanded "><a href="../specs/scoped-search-boundary.html"><strong aria-hidden="true">18.</strong> Scoped Search Boundary</a></li><li class="chapter-item expanded "><a href="../specs/scoped-search-boundary-implementation.html"><strong aria-hidden="true">19.</strong> Scoped Search Boundary — Implementation</a></li><li class="chapter-item expanded "><a href="../specs/frontend-domain-model.html"><strong aria-hidden="true">20.</strong> Frontend Domain Model</a></li><li class="chapter-item expanded "><a href="../specs/desktop-native-video.html"><strong aria-hidden="true">21.</strong> Desktop Native Video</a></li><li class="chapter-item expanded "><a href="../specs/build-provenance.html"><strong aria-hidden="true">22.</strong> Build Provenance</a></li><li class="chapter-item expanded affix "><li class="part-title">Build & Release</li><li class="chapter-item expanded "><a href="../build/build-release.html"><strong aria-hidden="true">23.</strong> Build & Release</a></li><li class="chapter-item expanded "><a href="../release-checklist.html"><strong aria-hidden="true">24.</strong> Release Checklist</a></li><li class="chapter-item expanded "><a href="../native-player-verification.html"><strong aria-hidden="true">25.</strong> Native Player Verification</a></li><li class="chapter-item expanded "><a href="../build/build-desktop-packages.html"><strong aria-hidden="true">26.</strong> Desktop Packaging</a></li><li class="chapter-item expanded "><a href="../build/build-windows.html"><strong aria-hidden="true">27.</strong> Windows Build</a></li><li class="chapter-item expanded "><a href="../defect-windows.html"><strong aria-hidden="true">28.</strong> Defect Windows</a></li><li class="chapter-item expanded "><a href="../build/docker.html"><strong aria-hidden="true">29.</strong> Docker</a></li><li class="chapter-item expanded "><a href="../build/build-builder-image.html" class="active"><strong aria-hidden="true">30.</strong> Builder Image</a></li><li class="chapter-item expanded affix "><li class="spacer"></li><li class="chapter-item expanded affix "><a href="../api-redirect.html">Rust API Reference (rustdoc)</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">JellyTau Documentation</h1>
<div class="right-buttons">
<a href="../print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://gitea.tourolle.paris/dtourolle/jellytau" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
<a href="https://gitea.tourolle.paris/dtourolle/jellytau/_edit/master/docs/../docs/build/build-builder-image.md" title="Suggest an edit" aria-label="Suggest an edit">
<i id="git-edit-button" class="fa fa-edit"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="building-and-pushing-the-jellytau-builder-image"><a class="header" href="#building-and-pushing-the-jellytau-builder-image">Building and Pushing the JellyTau Builder Image</a></h1>
<p>This document explains how to create and push the pre-built builder Docker image to your registry for use in Gitea Act CI/CD.</p>
<h2 id="prerequisites"><a class="header" href="#prerequisites">Prerequisites</a></h2>
<ul>
<li>Docker installed and running</li>
<li>Access to your Docker registry (e.g., <code>gitea.tourolle.paris</code>)</li>
<li>Docker registry credentials configured (<code>docker login</code>)</li>
</ul>
<h2 id="building-the-builder-image"><a class="header" href="#building-the-builder-image">Building the Builder Image</a></h2>
<h3 id="step-1-build-the-image-locally"><a class="header" href="#step-1-build-the-image-locally">Step 1: Build the Image Locally</a></h3>
<pre><code class="language-bash"># From the project root
docker build -f Dockerfile.builder -t jellytau-builder:latest .
</code></pre>
<p>This creates a local image with:</p>
<ul>
<li>All system dependencies</li>
<li>Rust with Android targets</li>
<li>Android SDK and NDK</li>
<li>Node.js and Bun</li>
<li>All build tools pre-installed</li>
</ul>
<h3 id="step-2-tag-for-your-registry"><a class="header" href="#step-2-tag-for-your-registry">Step 2: Tag for Your Registry</a></h3>
<p>Replace <code>gitea.tourolle.paris/dtourolle</code> with your actual registry path:</p>
<pre><code class="language-bash">docker tag jellytau-builder:latest gitea.tourolle.paris/dtourolle/jellytau-builder:latest
</code></pre>
<h3 id="step-3-login-to-your-registry"><a class="header" href="#step-3-login-to-your-registry">Step 3: Login to Your Registry</a></h3>
<p>If not already logged in:</p>
<pre><code class="language-bash">docker login gitea.tourolle.paris
</code></pre>
<h3 id="step-4-push-to-registry"><a class="header" href="#step-4-push-to-registry">Step 4: Push to Registry</a></h3>
<pre><code class="language-bash">docker push gitea.tourolle.paris/dtourolle/jellytau-builder:latest
</code></pre>
<h2 id="complete-one-liner"><a class="header" href="#complete-one-liner">Complete One-Liner</a></h2>
<pre><code class="language-bash">docker build -f Dockerfile.builder -t jellytau-builder:latest . &amp;&amp; \
docker tag jellytau-builder:latest gitea.tourolle.paris/dtourolle/jellytau-builder:latest &amp;&amp; \
docker push gitea.tourolle.paris/dtourolle/jellytau-builder:latest
</code></pre>
<h2 id="verifying-the-build"><a class="header" href="#verifying-the-build">Verifying the Build</a></h2>
<p>Check that the image was pushed successfully:</p>
<pre><code class="language-bash"># List images in your registry (depends on registry API support)
docker search gitea.tourolle.paris/dtourolle/jellytau-builder
# Or pull and test locally
docker pull gitea.tourolle.paris/dtourolle/jellytau-builder:latest
docker run -it gitea.tourolle.paris/dtourolle/jellytau-builder:latest bun --version
</code></pre>
<h2 id="using-in-cicd"><a class="header" href="#using-in-cicd">Using in CI/CD</a></h2>
<p>The workflow at <code>.gitea/workflows/build-and-test.yml</code> automatically uses:</p>
<pre><code class="language-yaml">container:
image: gitea.tourolle.paris/dtourolle/jellytau-builder:latest
</code></pre>
<p>Once pushed, your CI/CD pipeline will use this pre-built image instead of installing everything during the build, saving significant time.</p>
<h2 id="updating-the-builder-image"><a class="header" href="#updating-the-builder-image">Updating the Builder Image</a></h2>
<p>When dependencies change (new Rust version, Android SDK update, etc.):</p>
<ol>
<li>Update <code>Dockerfile.builder</code> with the new configuration</li>
<li>Rebuild and push with a new tag:</li>
</ol>
<pre><code class="language-bash">docker build -f Dockerfile.builder -t jellytau-builder:v1.2.0 .
docker tag jellytau-builder:v1.2.0 gitea.tourolle.paris/dtourolle/jellytau-builder:v1.2.0
docker push gitea.tourolle.paris/dtourolle/jellytau-builder:v1.2.0
</code></pre>
<ol start="3">
<li>Update the workflow to use the new tag:</li>
</ol>
<pre><code class="language-yaml">container:
image: gitea.tourolle.paris/dtourolle/jellytau-builder:v1.2.0
</code></pre>
<h2 id="image-contents"><a class="header" href="#image-contents">Image Contents</a></h2>
<p>The builder image includes:</p>
<ul>
<li><strong>Base OS</strong>: Ubuntu 24.04</li>
<li><strong>Languages</strong>:
<ul>
<li>Rust (stable) with targets: aarch64-linux-android, armv7-linux-androideabi, x86_64-linux-android</li>
<li>Node.js 20.x</li>
<li>OpenJDK 17 (for Android)</li>
</ul>
</li>
<li><strong>Tools</strong>:
<ul>
<li>Bun package manager</li>
<li>Android SDK 34</li>
<li>Android NDK 27.0.11902837</li>
<li>Build essentials (gcc, make, etc.)</li>
<li>Git, curl, wget</li>
<li>libssl, libclang development libraries</li>
</ul>
</li>
<li><strong>Pre-configured</strong>:
<ul>
<li>Rust toolchain components (rustfmt, clippy)</li>
<li>Android SDK/NDK environment variables</li>
<li>All paths optimized for building</li>
</ul>
</li>
</ul>
<h2 id="build-time"><a class="header" href="#build-time">Build Time</a></h2>
<p>First build takes ~15-20 minutes depending on internet speed (downloads Android SDK/NDK).
Subsequent builds are cached and take seconds.</p>
<h2 id="storage"><a class="header" href="#storage">Storage</a></h2>
<p>The built image is approximately <strong>4-5 GB</strong>. Ensure your registry has sufficient storage.</p>
<h2 id="troubleshooting"><a class="header" href="#troubleshooting">Troubleshooting</a></h2>
<h3 id="image-not-found-in-ci"><a class="header" href="#image-not-found-in-ci">"Image not found" in CI</a></h3>
<ul>
<li>Verify the image name matches exactly in the workflow</li>
<li>Check that the image was successfully pushed: <code>docker push</code> output should show successful layers</li>
<li>Ensure Gitea has access to your registry (check network/firewall)</li>
</ul>
<h3 id="build-fails-with-command-not-found"><a class="header" href="#build-fails-with-command-not-found">Build fails with "command not found"</a></h3>
<ul>
<li>The image may not have finished pushing. Wait a few moments and retry the CI job.</li>
<li>Check that all layers were pushed successfully in the push output.</li>
</ul>
<h3 id="registry-authentication-in-ci"><a class="header" href="#registry-authentication-in-ci">Registry authentication in CI</a></h3>
<p>If your registry requires credentials in CI:</p>
<ol>
<li>Create a deploy token in your registry</li>
<li>Add to Gitea secrets as <code>REGISTRY_USERNAME</code> and <code>REGISTRY_TOKEN</code></li>
<li>Use in workflow:</li>
</ol>
<pre><code class="language-yaml">- name: Login to Registry
run: |
docker login gitea.tourolle.paris -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_TOKEN }}
</code></pre>
<h2 id="references"><a class="header" href="#references">References</a></h2>
<ul>
<li><a href="https://docs.docker.com/build/">Docker Build Documentation</a></li>
<li><a href="https://docs.docker.com/engine/reference/commandline/push/">Docker Push Documentation</a></li>
<li><a href="https://docs.docker.com/engine/reference/builder/">Dockerfile Reference</a></li>
</ul>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="../build/docker.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="../api-redirect.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="../build/docker.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="../api-redirect.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="../elasticlunr.min.js"></script>
<script src="../mark.min.js"></script>
<script src="../searcher.js"></script>
<script src="../clipboard.min.js"></script>
<script src="../highlight.js"></script>
<script src="../book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>