feat: update docker build files

This commit is contained in:
2026-04-30 15:31:57 +08:00
Unverified
parent 78d64de371
commit c58271f6b6
3 changed files with 50 additions and 3 deletions
+1 -1
View File
@@ -16,4 +16,4 @@ COPY --from=builder /app/target/release/cdxs /usr/local/bin/cdxs
EXPOSE 8765
VOLUME ["/data"]
CMD ["cdxs", "server", "run", "--bind", "0.0.0.0:8765", "--data", "/data/cdxs.toml"]
CMD ["cdxs", "server", "run", "--bind", "0.0.0.0:8765", "--data-dir", "/data"]
+1 -2
View File
@@ -1,7 +1,6 @@
services:
cdxs-server:
build: .
image: cdxs-server:latest
image: docker.pchuan.top/cdxs:latest
container_name: cdxs-server
restart: unless-stopped
ports:
+48
View File
@@ -0,0 +1,48 @@
param(
[string]$Registry = "docker.pchuan.top",
[string]$ImageName = "cdxs",
[string]$Tag = "",
[switch]$NoLatest,
[string]$Platform = ""
)
$ErrorActionPreference = "Stop"
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
Set-Location $repoRoot
if (-not $Tag) {
$cargoToml = Get-Content -Raw -Path "Cargo.toml"
if ($cargoToml -notmatch '(?m)^version\s*=\s*"([^"]+)"') {
throw "Cannot read package version from Cargo.toml"
}
$Tag = $Matches[1]
}
$image = "$Registry/$ImageName"
$versionTag = "${image}:$Tag"
$latestTag = "${image}:latest"
Write-Host "Building $versionTag"
$buildArgs = @("build", "-t", $versionTag)
if (-not $NoLatest) {
$buildArgs += @("-t", $latestTag)
}
if ($Platform) {
$buildArgs += @("--platform", $Platform)
}
$buildArgs += "."
docker @buildArgs
Write-Host "Pushing $versionTag"
docker push $versionTag
if (-not $NoLatest) {
Write-Host "Pushing $latestTag"
docker push $latestTag
}
Write-Host "Published $versionTag"
if (-not $NoLatest) {
Write-Host "Published $latestTag"
}