Skip to content

Commit 55e1079

Browse files
committed
chore: better cleanuparr build - includes all assets (fonts icons)
1 parent 2268059 commit 55e1079

File tree

7 files changed

+68
-10
lines changed

7 files changed

+68
-10
lines changed

.github/actions/build-release-image/action.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ inputs:
3636
token:
3737
required: true
3838
description: "GitHub token for authentication"
39+
public_token:
40+
required: true
41+
description: "GitHub token for authentication (public packages)"
3942

4043
runs:
4144
using: composite
@@ -52,7 +55,11 @@ runs:
5255

5356
- name: Build and push image
5457
uses: docker/build-push-action@v6
58+
env:
59+
PUBLIC_TOKEN: ${{ inputs.public_token }}
5560
with:
61+
secrets: |
62+
id=PUBLIC_TOKEN,env=PUBLIC_TOKEN
5663
build-args: |
5764
VERSION=${{ inputs.upstream_version }}
5865
CHANNEL=${{ inputs.channel }}

.github/actions/build-test-image/action.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ inputs:
1717
tag_testing:
1818
required: true
1919
description: "Tag for testing"
20+
public_token:
21+
required: true
22+
description: "Github token for authentication (public packages)"
2023

2124
runs:
2225
using: composite
@@ -26,7 +29,11 @@ runs:
2629

2730
- name: Build Docker image (test)
2831
uses: docker/build-push-action@v6
32+
env:
33+
PUBLIC_TOKEN: ${{ inputs.public_token }}
2934
with:
35+
secrets: |
36+
id=PUBLIC_TOKEN,env=PUBLIC_TOKEN
3037
build-args: |
3138
VERSION=${{ inputs.upstream_version }}
3239
CHANNEL=${{ inputs.channel }}

.github/workflows/ci-cd.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ jobs:
114114
upstream_version: ${{ steps.vars.outputs.chan_upstream_version }}
115115
dockerfile: ${{ steps.vars.outputs.chan_dockerfile }}
116116
tag_testing: ${{ steps.vars.outputs.chan_tag_testing }}
117+
public_token: ${{ secrets.PUBLIC_PACKAGES }}
117118

118119
- name: Run Goss tests
119120
if: ${{ steps.vars.outputs.chan_tests_enabled == 'true' }}
@@ -136,6 +137,7 @@ jobs:
136137
tag_version: ${{ steps.vars.outputs.chan_tag_version }}
137138
platforms: ${{ steps.vars.outputs.chan_platforms }}
138139
token: ${{ secrets.GH_PAT }}
140+
public_token: ${{ secrets.PUBLIC_PACKAGES }}
139141

140142
notify-success:
141143
runs-on: ubuntu-latest

.github/workflows/manual-release-all.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ jobs:
8181
upstream_version: ${{ steps.vars.outputs.chan_upstream_version }}
8282
dockerfile: ${{ steps.vars.outputs.chan_dockerfile }}
8383
tag_testing: ${{ steps.vars.outputs.chan_tag_testing }}
84+
public_token: ${{ secrets.PUBLIC_PACKAGES }}
8485

8586
- name: Run Goss tests
8687
if: ${{ env.DRY_RUN != 'true' && steps.vars.outputs.chan_tests_enabled == 'true' }}
@@ -104,6 +105,7 @@ jobs:
104105
tag_version: ${{ steps.vars.outputs.chan_tag_version }}
105106
platforms: ${{ steps.vars.outputs.chan_platforms }}
106107
token: ${{ secrets.GH_PAT }}
108+
public_token: ${{ secrets.PUBLIC_PACKAGES }}
107109

108110
notify-success:
109111
runs-on: ubuntu-latest

.github/workflows/schedule-release.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
upstream_version: ${{ steps.vars.outputs.chan_upstream_version }}
8484
dockerfile: ${{ steps.vars.outputs.chan_dockerfile }}
8585
tag_testing: ${{ steps.vars.outputs.chan_tag_testing }}
86+
public_token: ${{ secrets.PUBLIC_PACKAGES }}
8687

8788
- name: Run Goss tests
8889
if: ${{ env.DRY_RUN != 'true' && steps.vars.outputs.chan_tests_enabled == 'true' }}
@@ -106,6 +107,7 @@ jobs:
106107
tag_version: ${{ steps.vars.outputs.chan_tag_version }}
107108
platforms: ${{ steps.vars.outputs.chan_platforms }}
108109
token: ${{ secrets.GH_PAT }}
110+
public_token: ${{ secrets.PUBLIC_PACKAGES }}
109111

110112
notify-success:
111113
runs-on: ubuntu-latest

Taskfile.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ tasks:
2121
-t {{.APP}}:{{.CHANNEL}}
2222
--build-arg CHANNEL={{.CHANNEL}}
2323
--build-arg VERSION={{.VERSION}}
24+
{{if ne .PUBLIC_TOKEN ""}}--secret id=PUBLIC_TOKEN,env=PUBLIC_TOKEN{{end}}
2425
-f ./apps/{{.APP}}/Dockerfile .
2526
- >-
2627
./.goss/dgoss run {{.APP}}:{{.CHANNEL}} {{if eq .BASE "true"}}tail -f /dev/null{{end}}
2728
vars:
2829
VERSION:
2930
sh: bash ./.github/scripts/upstream.sh "{{.APP}}" "{{.CHANNEL}}"
31+
PUBLIC_TOKEN: '{{.PUBLIC_TOKEN | default ""}}'
3032
env:
3133
CONTAINER_RUNTIME: docker
3234
GOSS_PATH: ./.goss/goss
@@ -47,6 +49,7 @@ tasks:
4749
-t {{.APP}}:{{.CHANNEL}}
4850
--build-arg CHANNEL={{.CHANNEL}}
4951
--build-arg VERSION={{.VERSION}}
52+
{{if ne .PUBLIC_TOKEN ""}}--secret id=PUBLIC_TOKEN,env=PUBLIC_TOKEN{{end}}
5053
-f ./apps/{{.APP}}/Dockerfile .
5154
- >-
5255
./.goss/dgoss run
@@ -57,6 +60,7 @@ tasks:
5760
vars:
5861
VERSION:
5962
sh: bash ./.github/scripts/upstream.sh "{{.APP}}" "{{.CHANNEL}}"
63+
PUBLIC_TOKEN: '{{.PUBLIC_TOKEN | default ""}}'
6064
SKIP_STARTUP: '{{.SKIP_STARTUP | default "false"}}'
6165
env:
6266
CONTAINER_RUNTIME: docker

apps/cleanuparr/Dockerfile

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,48 @@ FROM alpine AS cloner
33
ARG VERSION
44
ARG 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
1448
FROM ghcr.io/ipromknight/ubuntu:rolling
1549

1650
ARG DOTNET_VERSION="9.0.8"
@@ -42,13 +76,13 @@ RUN dotnet_archive=dotnet-runtime-${DOTNET_VERSION}-linux-x64.tar.gz \
4276
LABEL org.opencontainers.image.title="Cleanuparr"
4377

4478
WORKDIR /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
4681
COPY --chmod=0755 ./apps/cleanuparr/promknight-entrypoint.sh /promknight-entrypoint.sh
4782
ENV 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

Comments
 (0)