feat: update docker build files
This commit is contained in:
+1
-1
@@ -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
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user