diff --git a/BuildAndRun.ps1 b/BuildAndRun.ps1 new file mode 100644 index 00000000..912bcb1c --- /dev/null +++ b/BuildAndRun.ps1 @@ -0,0 +1,34 @@ +[CmdletBinding()] +param ( + [string] $Runtime = "linux-musl-x64", + [string[]] $RunArgs +) + +$ErrorActionPreference = "Stop" + +$artifactsDir = "$PSScriptRoot\docker\artifacts" + +# Delete old build artifacts +Remove-Item $artifactsDir -Recurse -Force -ErrorAction SilentlyContinue + +# Publish new build artifacts +& .\ci\Publish.ps1 -NoSingleFile ` + -OutputDir "$artifactsDir\$Runtime" ` + -Runtime $Runtime + +# Start the corresponding radarr/sonarr docker containers for testing/debugging +Push-Location "$PSScriptRoot\docker\debugging" +try { + docker compose up -d --pull always + if ($LASTEXITCODE -ne 0) { + throw "failed to bring up services stack" + } +} +finally { + Pop-Location +} + +docker compose run --rm --build app @RunArgs +if ($LASTEXITCODE -ne 0) { + throw "docker compose run failed" +} diff --git a/docker/Dockerfile b/Dockerfile similarity index 87% rename from docker/Dockerfile rename to Dockerfile index baa6fa04..bcd19f0b 100644 --- a/docker/Dockerfile +++ b/Dockerfile @@ -22,8 +22,8 @@ RUN set -ex; \ apk add --no-cache bash tzdata supercronic git tini; \ mkdir -p /config && chown 1000:1000 /config; -COPY ./artifacts/$RUNTIME /app/recyclarr/ -COPY --chmod=555 ./scripts/prod/*.sh / +COPY ./docker/artifacts/$RUNTIME /app/recyclarr/ +COPY --chmod=555 ./docker/scripts/prod/*.sh / USER 1000:1000 VOLUME /config diff --git a/debugging/certs/self-signed-cert-for-radarr.pfx b/debugging/certs/self-signed-cert-for-radarr.pfx deleted file mode 100644 index e3930bff..00000000 Binary files a/debugging/certs/self-signed-cert-for-radarr.pfx and /dev/null differ diff --git a/docker/docker-compose.yml b/docker-compose.yml similarity index 86% rename from docker/docker-compose.yml rename to docker-compose.yml index 4887507e..ad6a9f9c 100644 --- a/docker/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,12 @@ +name: recyclarr + networks: recyclarr: name: recyclarr_dev external: true services: - recyclarr: + app: image: ghcr.io/recyclarr/recyclarr:edge user: $DOCKER_UID:$DOCKER_GID container_name: recyclarr @@ -14,7 +16,7 @@ services: - TARGETARCH=amd64 networks: [recyclarr] volumes: - - ./config:/config + - ./docker/config:/config environment: CRON_SCHEDULE: "* * * * *" TZ: America/Chicago diff --git a/docker/BuildAndRun.ps1 b/docker/BuildAndRun.ps1 deleted file mode 100644 index 05ef2768..00000000 --- a/docker/BuildAndRun.ps1 +++ /dev/null @@ -1,48 +0,0 @@ -[CmdletBinding()] -param ( - [string] $Runtime = "linux-musl-x64", - [string[]] $RunArgs -) - -$ErrorActionPreference = "Stop" - -$artifactsDir = "$PSScriptRoot\artifacts" - -# Delete old build artifacts -Remove-Item $artifactsDir -Recurse -Force -ErrorAction SilentlyContinue - -# Publish new build artifacts -Push-Location $PSScriptRoot\.. -try { - & .\ci\Publish.ps1 -NoSingleFile ` - -OutputDir "$artifactsDir\$Runtime" ` - -Runtime $Runtime -} -finally { - Pop-Location -} - -# Start the corresponding radarr/sonarr docker containers for testing/debugging -Push-Location "$PSScriptRoot\..\debugging" -try { - docker compose up -d --pull always - if ($LASTEXITCODE -ne 0) { - throw "docker compose up failed" - } -} -finally { - Pop-Location -} - -# Finally, build the docker image and run it -docker compose build -if ($LASTEXITCODE -ne 0) { - throw "docker compose build failed" -} - -# TODO: Use `--build` when it releases: -# https://github.com/docker/compose/issues/10003 -docker compose run --rm recyclarr @RunArgs -if ($LASTEXITCODE -ne 0) { - throw "docker compose run failed" -} diff --git a/debugging/certs/cert-passwords.txt b/docker/debugging/certs/cert-passwords.txt similarity index 100% rename from debugging/certs/cert-passwords.txt rename to docker/debugging/certs/cert-passwords.txt diff --git a/debugging/docker-compose.yml b/docker/debugging/docker-compose.yml similarity index 100% rename from debugging/docker-compose.yml rename to docker/debugging/docker-compose.yml