@@ -3,14 +3,48 @@ FROM alpine AS cloner
33ARG VERSION
44ARG DOTNET_VERSION="9.0.8"
55
6- RUN mkdir -p /app && \
7- apk add --update --no-cache wget && \
8- wget -O /tmp/cleanuparr.zip https://github.com/Cleanuparr/Cleanuparr/releases/download/v${VERSION}/Cleanuparr-${VERSION}-linux-amd64.zip && \
9- unzip -o /tmp/cleanuparr.zip -d /app && \
10- mv /app/*/* /app/ 2>/dev/null || true && \
11- chmod +x /app/Cleanuparr && \
12- rm -rf /tmp/cleanuparr*
6+ RUN apk add --update --no-cache git
137
8+ RUN mkdir -p /src || exit 1 \
9+ && git clone --depth 1 --branch v${VERSION} https://github.com/Cleanuparr/Cleanuparr.git /src
10+
11+ # Build Angular frontend
12+ FROM --platform=$BUILDPLATFORM node:18-alpine AS frontend-build
13+ WORKDIR /app
14+ COPY --from=cloner /src/code/frontend/package*.json ./
15+ RUN npm ci && npm install -g @angular/cli
16+ COPY --from=cloner /src/code/frontend/ .
17+ RUN npm run build
18+
19+ # Build .NET backend
20+ FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0-bookworm-slim AS build
21+ ARG TARGETARCH
22+ ARG VERSION=0.0.1
23+ ARG PACKAGES_USERNAME=ipromknight
24+ WORKDIR /app
25+ COPY --from=cloner /src/code/backend/ ./backend/
26+
27+ RUN --mount=type=secret,id=PUBLIC_TOKEN \
28+ dotnet nuget add source \
29+ --name Cleanuparr \
30+ --username "${PACKAGES_USERNAME}" \
31+ --password "$(cat /run/secrets/PUBLIC_TOKEN)" \
32+ --store-password-in-clear-text \
33+ https://nuget.pkg.github.com/Cleanuparr/index.json \
34+ && dotnet restore -a $TARGETARCH ./backend/Cleanuparr.Api/Cleanuparr.Api.csproj \
35+ && dotnet nuget remove source Cleanuparr \
36+ && rm -f /root/.nuget/NuGet/NuGet.Config
37+
38+ RUN dotnet publish ./backend/Cleanuparr.Api/Cleanuparr.Api.csproj \
39+ -a $TARGETARCH \
40+ -c Release \
41+ -o /app/publish \
42+ --no-restore \
43+ /p:Version=${VERSION} \
44+ /p:PublishSingleFile=true \
45+ /p:DebugSymbols=false
46+
47+ # Final stage
1448FROM ghcr.io/ipromknight/ubuntu:rolling
1549
1650ARG DOTNET_VERSION="9.0.8"
@@ -42,13 +76,13 @@ RUN dotnet_archive=dotnet-runtime-${DOTNET_VERSION}-linux-x64.tar.gz \
4276LABEL org.opencontainers.image.title="Cleanuparr"
4377
4478WORKDIR /app
45- COPY --from=cloner --chown=568:568 /app .
79+ COPY --from=build --chown=568:568 /app/publish .
80+ COPY --from=frontend-build --chown=568:568 /app/dist/ui/browser ./wwwroot
4681COPY --chmod=0755 ./apps/cleanuparr/promknight-entrypoint.sh /promknight-entrypoint.sh
4782ENV PUID=568 \
4883 PGID=568 \
4984 UMASK=022 \
5085 TZ=Etc/UTC \
5186 HTTP_PORTS=11011 \
5287 DOTNET_USE_POLLING_FILE_WATCHER=true \
53- SEED_USER=true
54-
88+ SEED_USER=true
0 commit comments