Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: check if bundling is useful #5

Merged
merged 9 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ node_modules
.gitignore
*.md
dist
repos
dockerrepos
playwright-report
test-results
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches-ignore:
- prod

jobs:
test:
name: Lint & Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: latest

- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm

- run: pnpm install

- name: Lint
run: pnpm lint

- name: Test
run: pnpm test
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta_pms.outputs.tags }}
labels: ${{ steps.meta_pms.outputs.labels }}
target: prod
# - name: Docker Hub Description
# if: github.event_name != 'pull_request'
# uses: peter-evans/dockerhub-description@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,4 @@ secrets.yml

test*.json
repos/
dockerrepos
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
45 changes: 35 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,58 @@
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md
FROM node:22.9.0-slim AS base
WORKDIR /app

ENV PNPM_HOME="/opt/pnpm"
ENV COREPACK_HOME="/opt/corepack"
ENV PATH="$PNPM_HOME:$PATH"

RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json pnpm-lock.yaml /app/

COPY package.json pnpm-lock.yaml ./

# Do it here to add the packageManager field to the package.json
RUN corepack enable \
&& corepack prepare pnpm@9 --activate \
&& corepack use pnpm@9

FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
RUN pnpm config set store-dir ~/.pnpm-store

RUN --mount=type=cache,id=pnpm,target=~/.pnpm-store pnpm install --frozen-lockfile

FROM base
COPY --from=prod-deps /app/node_modules /app/node_modules
COPY index.ts /app/
COPY src/ /app/src/
FROM base AS builder
COPY src src/
COPY index.ts esbuild.ts ./

RUN pnpm run build

FROM base AS dev
ENV CONFIG_LOCATION=/app/config/config.yml
ENV SECRETS_LOCATION=/app/config/secrets.yml
# manually mount src etc

CMD [ "pnpm", "start" ]

# https://github.com/evanw/esbuild/issues/1921
# TODO not using alpine for now because different error messages for example for requests.
FROM node:22.9.0-slim AS prod
WORKDIR /app

RUN chmod uga+rw -R /app/package.json
#RUN apk add --no-cache libstdc++ dumb-init git

RUN apt-get update && apt-get install -y \
git \
dumb-init \
&& rm -rf /var/lib/apt/lists/*

# TODO maybe in future. Results in breaking change
#USER node

CMD [ "pnpm", "start" ]
COPY --from=builder /app/bundle.cjs /app/index.js

ENV CONFIG_LOCATION=/app/config/config.yml
ENV SECRETS_LOCATION=/app/config/secrets.yml

# Run with dumb-init to not start node with PID=1, since Node.js was not designed to run as PID 1
CMD ["dumb-init", "node", "index.js"]
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Supporting only Sonarr v4 and radarr v4.
This will be a project similar to [Recyclarr](https://github.com/recyclarr/recyclarr) or [Notifiarr](https://notifiarr.wiki/) but support for additional specification and not only what [TrashGuides](https://trash-guides.info/) offer.

Other projects:

- https://github.com/recyclarr/recyclarr
- https://notifiarr.wiki/
- https://github.com/Dictionarry-Hub/profilarr
Expand Down Expand Up @@ -45,6 +46,7 @@ See [here](./custom/cfs/)
### How to add own CustomFormats

- You have two ways to provide own custom formats:

- `As file`
- Export from Sonarr/Radarr instance UI (in the CustomFormats list you have two icons for each custom format: clone and export)
- Or use existing custom formats from recyclarr or trash guide
Expand All @@ -68,6 +70,7 @@ See [here](./custom/cfs/)
fields:
value: 4
```

- What you have to add at least is to the field `trash_id` or `configarr_id` to the JSON/YAML.
The ID can be anything you like but should not conflict with other CustomFormats.
Otherwise those will be overwritten during merge process.
Expand All @@ -78,6 +81,7 @@ See [here](./custom/cfs/)
...other content from export
}
```

- Add it as custom format location in your `config.yml`
- After adding the ID you can simply reference it in the `config.yml` to add it to the QualityProfiles. `localCustomFormatsPath: /your/path/cfs`

Expand Down Expand Up @@ -105,10 +109,12 @@ Some examples for configuration are provided [Examples](./examples/)
## How to run

Required files:

- `config.yml`
- `secrets.yml`

Optional:

- Custom Formats in folders

### Docker
Expand All @@ -118,7 +124,6 @@ Optional:
### Docker-compose

```yml

services:
configarr:
image: ghcr.io/raydak-labs/configarr:latest
Expand Down
174 changes: 87 additions & 87 deletions custom/cfs/de-tier-01.json
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
{
"trash_id": "de-tier-01-version1",
"trash_scores": {},
"name": "GER HD Rel. Group Tier 01",
"includeCustomFormatWhenRenaming": false,
"specifications": [
{
"name": "ZeroTwo",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "ZeroTwo"
}
},
{
"name": "WAYNE",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "WAYNE"
}
},
{
"name": "TSCC",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "TSCC"
}
},
{
"name": "DETAiLS",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "DETAiLS"
}
},
{
"name": "FoST",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "FoST"
}
},
{
"name": "SAUERKRAUT",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "SAUERKRAUT"
}
},
{
"name": "Baka (Anime)",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "Baka"
}
},
{
"name": "D02KU",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "D02KU"
}
},
{
"name": "WvF",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "WvF"
}
}
]
"trash_id": "de-tier-01-version1",
"trash_scores": {},
"name": "GER HD Rel. Group Tier 01",
"includeCustomFormatWhenRenaming": false,
"specifications": [
{
"name": "ZeroTwo",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "ZeroTwo"
}
},
{
"name": "WAYNE",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "WAYNE"
}
},
{
"name": "TSCC",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "TSCC"
}
},
{
"name": "DETAiLS",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "DETAiLS"
}
},
{
"name": "FoST",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "FoST"
}
},
{
"name": "SAUERKRAUT",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "SAUERKRAUT"
}
},
{
"name": "Baka (Anime)",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "Baka"
}
},
{
"name": "D02KU",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "D02KU"
}
},
{
"name": "WvF",
"implementation": "ReleaseGroupSpecification",
"negate": false,
"required": false,
"fields": {
"value": "WvF"
}
}
]
}
Loading