Bring in pipeline, auth, deploy and docs from the boilerplate
roledesk is built on the boilerplate from here on: pipeline 2.0 (queue and scheduler), auth (one password, sessions, passkeys), the deploy kit and its docs, plus the coupling and packaging tests. Downstream copies, unedited. Refreshed from boilerplate/d56949f7d0f6c0bfe5745478e09007bfad67ae87 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1f436104f3
commit
9d666d0937
76 files changed
+15235
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Build a local Docker image from the committed production branch.
|
||||
.DESCRIPTION
|
||||
Does not test, promote, push Git branches, use SSH, or start a container.
|
||||
The image stays local. Use 3-push-image.ps1 to publish it separately.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
. "$PSScriptRoot/_common.ps1"
|
||||
|
||||
$Image = Setting IMAGE -Required
|
||||
$Branch = Setting BRANCH 'production'
|
||||
$Platform = Setting PLATFORM 'linux/amd64'
|
||||
|
||||
Push-Location $root
|
||||
try {
|
||||
$commit = git rev-parse --verify "$Branch^{commit}"
|
||||
Assert-Ok 'resolve production commit'
|
||||
$commit = $commit.Trim()
|
||||
$sha = (git rev-parse --short $commit).Trim()
|
||||
Assert-Ok 'resolve image tag'
|
||||
$tagged = "${Image}:${sha}"
|
||||
$latest = "${Image}:latest"
|
||||
|
||||
# --------------------------------------------------------------- build
|
||||
|
||||
# `git archive` to a file and unpack it, rather than piping it. A PowerShell
|
||||
# pipeline carries text: it would re-encode a tar stream and hand docker a
|
||||
# corrupted context. Writing the archive out and building from the directory
|
||||
# keeps the same guarantee -- the context is the committed tree and nothing
|
||||
# else -- without a byte going through a pipe.
|
||||
#
|
||||
# The Dockerfile comes out of that same tree, at deploy/Dockerfile, so the
|
||||
# recipe is versioned with the code it builds. Docker reads the ignore rules
|
||||
# from deploy/Dockerfile.dockerignore beside it.
|
||||
|
||||
Write-Step "build $tagged"
|
||||
$ctx = Join-Path ([IO.Path]::GetTempPath()) "$Name-build-$sha"
|
||||
$tar = "$ctx.tar"
|
||||
Remove-ReleaseTemp @($ctx, $tar)
|
||||
New-Item -ItemType Directory -Path $ctx | Out-Null
|
||||
try {
|
||||
git archive --format=tar -o $tar $commit; Assert-Ok 'git archive'
|
||||
tar -xf $tar -C $ctx; Assert-Ok 'tar -xf'
|
||||
$dockerfile = Join-Path $ctx 'deploy/Dockerfile'
|
||||
docker build --platform $Platform -f $dockerfile -t $tagged -t $latest $ctx
|
||||
Assert-Ok 'docker build'
|
||||
docker image ls $Image --format ' {{.Tag}} {{.Size}}'
|
||||
} finally {
|
||||
Remove-ReleaseTemp @($ctx, $tar)
|
||||
}
|
||||
|
||||
Write-Host "Image: $tagged"
|
||||
} finally { Pop-Location }
|
||||
Reference in new issue
Block a user