Merge pull request #224 from ravensorb/master
Updates to Docker Build Process
This commit is contained in:
commit
cb2fa9f155
11 changed files with 53 additions and 25 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -6,3 +6,4 @@ node_modules/
|
||||||
RealDebridClient.zip
|
RealDebridClient.zip
|
||||||
server/RdtClient.Web/appsettings.Development.json
|
server/RdtClient.Web/appsettings.Development.json
|
||||||
data
|
data
|
||||||
|
Dockerfile.dev
|
||||||
22
Dockerfile
22
Dockerfile
|
|
@ -45,7 +45,7 @@ RUN \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stage 3 - Build runtime image
|
# Stage 3 - Build runtime image
|
||||||
FROM ghcr.io/linuxserver/baseimage-ubuntu:bionic
|
FROM ghcr.io/linuxserver/baseimage-alpine:3.17
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
|
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
|
||||||
ARG BUILDPLATFORM
|
ARG BUILDPLATFORM
|
||||||
|
|
@ -65,26 +65,21 @@ ENV RDTCLIENT_BRANCH="main"
|
||||||
RUN \
|
RUN \
|
||||||
mkdir -p /data/downloads /data/db || true && \
|
mkdir -p /data/downloads /data/db || true && \
|
||||||
echo "**** Updating package information ****" && \
|
echo "**** Updating package information ****" && \
|
||||||
apt-get update -y -qq && \
|
apk update && \
|
||||||
echo "**** Install pre-reqs ****" && \
|
echo "**** Install pre-reqs ****" && \
|
||||||
apt-get install -y -qq wget dos2unix && \
|
apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib && \
|
||||||
apt-get install -y libc6 libgcc1 libgssapi-krb5-2 libssl1.1 libstdc++6 zlib1g libicu60 && \
|
|
||||||
echo "**** Installing dotnet ****" && \
|
echo "**** Installing dotnet ****" && \
|
||||||
wget -q https://dot.net/v1/dotnet-install.sh && \
|
apk add aspnetcore6-runtime && \
|
||||||
chmod +x ./dotnet-install.sh && \
|
|
||||||
bash ./dotnet-install.sh -c LTS -v latest --runtime dotnet --install-dir /usr/share/dotnet && \
|
|
||||||
bash ./dotnet-install.sh -c LTS -v latest --runtime aspnetcore --install-dir /usr/share/dotnet && \
|
|
||||||
echo "**** Cleaning image ****" && \
|
|
||||||
apt-get -y -qq -o Dpkg::Use-Pty=0 clean && apt-get -y -qq -o Dpkg::Use-Pty=0 purge && \
|
|
||||||
echo "**** Setting permissions ****" && \
|
echo "**** Setting permissions ****" && \
|
||||||
chown -R abc:abc /data && \
|
chown -R abc:abc /data && \
|
||||||
rm -rf \
|
rm -rf \
|
||||||
/tmp/* \
|
/tmp/* \
|
||||||
/var/lib/apt/lists/* \
|
/var/cache/apk/* \
|
||||||
/var/tmp/* || true
|
/var/tmp/* || true
|
||||||
|
|
||||||
ENV PATH "$PATH:/usr/share/dotnet"
|
ENV PATH "$PATH:/usr/share/dotnet"
|
||||||
|
|
||||||
|
# Copy files for app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=dotnet-build-env /appserver/server/out .
|
COPY --from=dotnet-build-env /appserver/server/out .
|
||||||
COPY --from=node-build-env /appclient/client/out ./wwwroot
|
COPY --from=node-build-env /appclient/client/out ./wwwroot
|
||||||
|
|
@ -92,4 +87,7 @@ COPY --from=node-build-env /appclient/root/ /
|
||||||
|
|
||||||
# ports and volumes
|
# ports and volumes
|
||||||
EXPOSE 6500
|
EXPOSE 6500
|
||||||
VOLUME ["/config", "/data" ]
|
VOLUME [ "/data" ]
|
||||||
|
|
||||||
|
# Check Status
|
||||||
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 CMD curl --fail http://localhost:6500 || exit
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
param(
|
param(
|
||||||
[string]$TempPath="c:/Temp/RtdClient",
|
[string]$TempPath="c:/Temp/RtdClient",
|
||||||
|
[string]$Dockerfile="Dockerfile",
|
||||||
[switch]$AutoAttach,
|
[switch]$AutoAttach,
|
||||||
[switch]$IgnoreBuildCache,
|
[switch]$SkipCache,
|
||||||
[string]$BuildProgress="auto"
|
[string]$BuildProgress="auto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -17,8 +18,8 @@ Write-Host "removing Container (if exists)"
|
||||||
docker rm rdtclientdev
|
docker rm rdtclientdev
|
||||||
|
|
||||||
Write-Host "Building Container"
|
Write-Host "Building Container"
|
||||||
$dockerArgs = @( "build", "--force-rm", "--tag", "rdtclientdev", "--progress=$BuildProgress", "." )
|
$dockerArgs = @( "build", "--force-rm", "--tag", "rdtclientdev", "--progress=$BuildProgress", "--file", $Dockerfile, "." )
|
||||||
if ($IgnoreBuildCache.IsPresent) { $dockerArgs += @("--no-cace" ) }
|
if ($SkipCache.IsPresent) { $dockerArgs += @("--no-cache" ) }
|
||||||
& docker $dockerArgs
|
& docker $dockerArgs
|
||||||
|
|
||||||
Write-Host "Starting Container"
|
Write-Host "Starting Container"
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ services:
|
||||||
rdtclient:
|
rdtclient:
|
||||||
image: rogerfar/rdtclient
|
image: rogerfar/rdtclient
|
||||||
container_name: rdtclient
|
container_name: rdtclient
|
||||||
build:
|
# build:
|
||||||
context: .
|
# context: .
|
||||||
dockerfile: Dockerfile
|
# dockerfile: Dockerfile
|
||||||
environment:
|
environment:
|
||||||
- PUID=1001
|
- PUID=1001
|
||||||
- PGID=1001
|
- PGID=1001
|
||||||
|
|
@ -20,3 +20,9 @@ services:
|
||||||
max-size: 10m
|
max-size: 10m
|
||||||
ports:
|
ports:
|
||||||
- '6500:6500'
|
- '6500:6500'
|
||||||
|
healthcheck:
|
||||||
|
test: curl --fail http://localhost:6500 || exit 1
|
||||||
|
interval: 30s
|
||||||
|
retries: 3
|
||||||
|
start_period: 30s
|
||||||
|
timeout: 30s
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/pwsh
|
#!/usr/bin/env pwsh
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Helper script to execute docker buildx
|
Helper script to execute docker buildx
|
||||||
|
|
@ -34,12 +34,28 @@
|
||||||
param(
|
param(
|
||||||
[string]$Version = "",
|
[string]$Version = "",
|
||||||
[string]$DockerAccount = "rogerfar",
|
[string]$DockerAccount = "rogerfar",
|
||||||
[string]$Platforms = "linux/arm/v7,linux/arm64/v8,linux/amd64"
|
[string]$Platforms = "linux/arm/v7,linux/arm64/v8,linux/amd64",
|
||||||
|
[string]$Dockerfile = "Dockerfile",
|
||||||
|
[switch]$SkipPush,
|
||||||
|
[switch]$SkipCache,
|
||||||
|
[switch]$OutputToDocker
|
||||||
)
|
)
|
||||||
|
|
||||||
$imageName = "$($DockerAccount)/rdtclient"
|
$imageName = "$($DockerAccount)/rdtclient"
|
||||||
|
|
||||||
$dockerArgs = @( "buildx", "build", "--no-cache", "--push", "--platform", $Platforms, "--tag", "$($imageName):latest", "." )
|
$dockerArgs = @( "buildx", "build", "--network=default", "--platform", $Platforms, "--tag", "$($imageName):latest", "--file", $Dockerfile, "." )
|
||||||
|
|
||||||
|
if (-Not $SkipPush.IsPresent) {
|
||||||
|
$dockerArgs += @("--push")
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($SkipCache.IsPresent) {
|
||||||
|
$dockerArgs += @("--no-cache")
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OutputToDocker.IsPresent) {
|
||||||
|
$dockerArgs += @("--output=type=docker")
|
||||||
|
}
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($Version)) {
|
if ([string]::IsNullOrEmpty($Version)) {
|
||||||
$Version = (Get-Content "package.json" | ConvertFrom-Json).version
|
$Version = (Get-Content "package.json" | ConvertFrom-Json).version
|
||||||
|
|
@ -49,4 +65,5 @@ $dockerArgs += @("--tag", "$($imageName):$($Version)" )
|
||||||
$dockerApps += @("--build-arg", "VERSION=$($Version)" )
|
$dockerApps += @("--build-arg", "VERSION=$($Version)" )
|
||||||
|
|
||||||
Write-Host "Generating docker image $imageName for $Platforms"
|
Write-Host "Generating docker image $imageName for $Platforms"
|
||||||
|
Write-Host "Args: $dockerArgs"
|
||||||
& docker $dockerArgs
|
& docker $dockerArgs
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,4 @@
|
||||||
# permissions
|
# permissions
|
||||||
echo "Setting permissions"
|
echo "Setting permissions"
|
||||||
chown -R abc:abc \
|
chown -R abc:abc \
|
||||||
/app /data /config
|
/app /data
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
etc/s6-overlay/s6-rc.d/init-rdt-client/run
|
/etc/s6-overlay/s6-rc.d/init-rdt-client/run
|
||||||
5
root/etc/s6-overlay/s6-rc.d/svc-rdt-client/run
Normal file → Executable file
5
root/etc/s6-overlay/s6-rc.d/svc-rdt-client/run
Normal file → Executable file
|
|
@ -5,6 +5,11 @@ if [ -n "${UMASK_SET}" ] && [ -z "${UMASK}" ]; then
|
||||||
umask ${UMASK_SET}
|
umask ${UMASK_SET}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# permissions
|
||||||
|
echo "Setting permissions"
|
||||||
|
chown -R abc:abc \
|
||||||
|
/app /data
|
||||||
|
|
||||||
echo "Changing to /app folder"
|
echo "Changing to /app folder"
|
||||||
cd /app || exit
|
cd /app || exit
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue