Skip to content

Commit 5aaf282

Browse files
author
User Ahze
committed
Initial commit
0 parents  commit 5aaf282

13 files changed

Lines changed: 377 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Build FreeBSD Container
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths-ignore: ['*.md', 'LICENSE', '.gitignore']
7+
pull_request:
8+
branches: [main]
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
uses: daemonless/daemonless/.github/workflows/build-app.yml@main
14+
with:
15+
image_name: sonarr
16+
secrets: inherit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scripts/build.sh

.woodpecker.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Woodpecker CI configuration
2+
# Calls the same build script as GitHub Actions
3+
4+
steps:
5+
- name: build-latest
6+
image: /bin/sh
7+
environment:
8+
GITHUB_TOKEN:
9+
from_secret: GITHUB_TOKEN
10+
GITHUB_ACTOR:
11+
from_secret: GITHUB_USER
12+
commands:
13+
- |
14+
# Download shared build script (pinned to version)
15+
mkdir -p scripts
16+
fetch -qo scripts/build.sh \
17+
"https://raw.githubusercontent.com/daemonless/daemonless/build-v1.0.0/scripts/build.sh"
18+
chmod +x scripts/build.sh
19+
20+
./scripts/build.sh \
21+
--doas \
22+
--registry ghcr.io \
23+
--image ghcr.io/daemonless/sonarr \
24+
--containerfile Containerfile \
25+
--tag latest \
26+
--tag-version \
27+
--skip-wip \
28+
--login --push
29+
30+
- name: build-pkg
31+
image: /bin/sh
32+
environment:
33+
GITHUB_TOKEN:
34+
from_secret: GITHUB_TOKEN
35+
GITHUB_ACTOR:
36+
from_secret: GITHUB_USER
37+
commands:
38+
- |
39+
# Download shared build script (pinned to version)
40+
mkdir -p scripts
41+
fetch -qo scripts/build.sh \
42+
"https://raw.githubusercontent.com/daemonless/daemonless/build-v1.0.0/scripts/build.sh"
43+
chmod +x scripts/build.sh
44+
45+
./scripts/build.sh \
46+
--doas \
47+
--registry ghcr.io \
48+
--image ghcr.io/daemonless/sonarr \
49+
--containerfile Containerfile.pkg \
50+
--base-version 15-quarterly \
51+
--tag pkg \
52+
--tag-version \
53+
--version-suffix "-pkg" \
54+
--skip-wip \
55+
--login --push
56+
57+
- name: build-pkg-latest
58+
image: /bin/sh
59+
environment:
60+
GITHUB_TOKEN:
61+
from_secret: GITHUB_TOKEN
62+
GITHUB_ACTOR:
63+
from_secret: GITHUB_USER
64+
commands:
65+
- |
66+
# Download shared build script (pinned to version)
67+
mkdir -p scripts
68+
fetch -qo scripts/build.sh \
69+
"https://raw.githubusercontent.com/daemonless/daemonless/build-v1.0.0/scripts/build.sh"
70+
chmod +x scripts/build.sh
71+
72+
./scripts/build.sh \
73+
--doas \
74+
--registry ghcr.io \
75+
--image ghcr.io/daemonless/sonarr \
76+
--containerfile Containerfile.pkg \
77+
--base-version 15 \
78+
--tag pkg-latest \
79+
--tag-version \
80+
--version-suffix "-pkg-latest" \
81+
--skip-wip \
82+
--login --push
83+
84+
when:
85+
- event: push
86+
branch: main
87+
path:
88+
exclude: [ "*.md", "docs/**", "LICENSE", ".gitignore" ]
89+
- event: manual

.woodpecker_full_rebuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Mon Dec 22 16:45:46 EST 2025

.woodpecker_test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Mon Dec 22 06:39:35 EST 2025

Containerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
ARG BASE_VERSION=15
2+
FROM ghcr.io/daemonless/arr-base:${BASE_VERSION}
3+
4+
ARG FREEBSD_ARCH=amd64
5+
LABEL org.opencontainers.image.title="sonarr" \
6+
org.opencontainers.image.description="Sonarr TV show management on FreeBSD" \
7+
org.opencontainers.image.source="https://github.com/daemonless/sonarr" \
8+
org.opencontainers.image.url="https://sonarr.tv/" \
9+
org.opencontainers.image.documentation="https://wiki.servarr.com/sonarr" \
10+
org.opencontainers.image.licenses="GPL-3.0-only" \
11+
org.opencontainers.image.vendor="daemonless" \
12+
org.opencontainers.image.authors="daemonless" \
13+
io.daemonless.port="8989" \
14+
io.daemonless.arch="${FREEBSD_ARCH}" \
15+
io.daemonless.volumes="/tv,/downloads" \
16+
org.freebsd.jail.allow.mlock="required"
17+
18+
# Download and install Sonarr (fetch latest v4-stable FreeBSD URL from API)
19+
RUN mkdir -p /usr/local/share/sonarr && \
20+
SONARR_VERSION=$(fetch -qo - "https://services.sonarr.tv/v1/releases" | \
21+
grep -o '"version":"[^"]*"' | head -n 1 | cut -d '"' -f 4) && \
22+
SONARR_URL=$(fetch -qo - "https://services.sonarr.tv/v1/releases" | \
23+
grep -o '"freeBsd":{"x64":{"archive":{"url":"[^"]*"' | \
24+
sed -n '1s/.*"url":"\([^"]*\)".*/\1/p') && \
25+
echo "Downloading Sonarr $SONARR_VERSION from: $SONARR_URL" && \
26+
fetch -qo - "$SONARR_URL" | \
27+
tar xzf - -C /usr/local/share/sonarr --strip-components=1 && \
28+
rm -rf /usr/local/share/sonarr/Sonarr.Update && \
29+
chmod +x /usr/local/share/sonarr/Sonarr && \
30+
chmod -R o+rX /usr/local/share/sonarr && \
31+
printf "UpdateMethod=docker\nBranch=main\nPackageVersion=%s\nPackageAuthor=[daemonless](https://github.com/daemonless/daemonless)\n" "$SONARR_VERSION" > /usr/local/share/sonarr/package_info && \
32+
mkdir -p /app && echo "$SONARR_VERSION" > /app/version
33+
34+
# Create config directory
35+
RUN mkdir -p /config && \
36+
chown -R bsd:bsd /usr/local/share/sonarr /config
37+
38+
# Copy service definition and init scripts
39+
COPY root/ /
40+
41+
# Make scripts executable
42+
RUN chmod +x /etc/services.d/sonarr/run /etc/cont-init.d/* 2>/dev/null || true
43+
44+
EXPOSE 8989
45+
VOLUME /config
46+
47+

Containerfile.pkg

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
ARG BASE_VERSION=15
2+
FROM ghcr.io/daemonless/base:${BASE_VERSION}
3+
4+
ARG FREEBSD_ARCH=amd64
5+
LABEL org.opencontainers.image.title="sonarr" \
6+
org.opencontainers.image.description="Sonarr TV show management on FreeBSD" \
7+
org.opencontainers.image.source="https://github.com/daemonless/sonarr" \
8+
org.opencontainers.image.url="https://sonarr.tv/" \
9+
org.opencontainers.image.documentation="https://wiki.servarr.com/sonarr" \
10+
org.opencontainers.image.licenses="GPL-3.0-only" \
11+
org.opencontainers.image.vendor="daemonless" \
12+
org.opencontainers.image.authors="daemonless" \
13+
io.daemonless.port="8989" \
14+
io.daemonless.arch="${FREEBSD_ARCH}" \
15+
io.daemonless.volumes="/tv,/downloads" \
16+
org.freebsd.jail.allow.mlock="required"
17+
18+
# Install Sonarr from FreeBSD packages
19+
RUN pkg update && \
20+
pkg install -y sonarr && \
21+
pkg clean -ay && \
22+
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
23+
24+
# Override package_info to show container update instructions
25+
RUN SONARR_VERSION=$(pkg info sonarr | sed -n 's/.*Version.*: *//p') && \
26+
printf "UpdateMethod=docker\nBranch=main\nPackageVersion=%s\nPackageAuthor=[daemonless](https://github.com/daemonless/daemonless)\n" "$SONARR_VERSION" > /usr/local/share/sonarr/package_info && \
27+
mkdir -p /app && echo "$SONARR_VERSION" > /app/version
28+
29+
# Create config directory
30+
RUN mkdir -p /config && \
31+
chown -R bsd:bsd /config
32+
33+
# Copy service definition
34+
COPY root/ /
35+
36+
# Use pkg-specific run script
37+
COPY root/etc/services.d/sonarr/run.pkg /etc/services.d/sonarr/run
38+
39+
# Make scripts executable
40+
RUN chmod +x /etc/services.d/sonarr/run /etc/cont-init.d/* 2>/dev/null || true
41+
42+
# Set up s6 service link
43+
RUN mkdir -p /run/s6/services/sonarr && \
44+
ln -sf /etc/services.d/sonarr/run /run/s6/services/sonarr/run
45+
46+
EXPOSE 8989
47+
VOLUME /config
48+

LICENSE

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2025, daemonless contributors
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# sonarr
2+
3+
TV show collection manager for Usenet and BitTorrent users.
4+
5+
## Environment Variables
6+
7+
| Variable | Description | Default |
8+
|----------|-------------|---------|
9+
| `PUID` | User ID for the application process | `1000` |
10+
| `PGID` | Group ID for the application process | `1000` |
11+
| `TZ` | Timezone for the container | `UTC` |
12+
| `S6_LOG_ENABLE` | Enable/Disable file logging | `1` |
13+
| `S6_LOG_MAX_SIZE` | Max size per log file (bytes) | `1048576` |
14+
| `S6_LOG_MAX_FILES` | Number of rotated log files to keep | `10` |
15+
16+
## Logging
17+
18+
This image uses `s6-log` for internal log rotation.
19+
- **System Logs**: Captured from console and stored at `/config/logs/daemonless/sonarr/`.
20+
- **Application Logs**: Managed by the app and typically found in `/config/logs/`.
21+
- **Podman Logs**: Output is mirrored to the console, so `podman logs` still works.
22+
23+
## Quick Start
24+
25+
```bash
26+
podman run -d --name sonarr \
27+
-p 8989:8989 \
28+
--annotation 'org.freebsd.jail.allow.mlock=true' \
29+
-e PUID=1000 -e PGID=1000 \
30+
-v /path/to/config:/config \
31+
-v /path/to/tv:/tv \
32+
-v /path/to/downloads:/downloads \
33+
ghcr.io/daemonless/sonarr:latest
34+
```
35+
36+
Access at: http://localhost:8989
37+
38+
## podman-compose
39+
40+
```yaml
41+
services:
42+
sonarr:
43+
image: ghcr.io/daemonless/sonarr:latest
44+
container_name: sonarr
45+
environment:
46+
- PUID=1000
47+
- PGID=1000
48+
- TZ=America/New_York
49+
volumes:
50+
- /data/config/sonarr:/config
51+
- /data/media/tv:/tv
52+
- /data/downloads:/downloads
53+
ports:
54+
- 8989:8989
55+
annotations:
56+
org.freebsd.jail.allow.mlock: "true"
57+
restart: unless-stopped
58+
```
59+
60+
## Tags
61+
62+
| Tag | Source | Description |
63+
|-----|--------|-------------|
64+
| `:latest` | [Upstream Releases](https://services.sonarr.tv/v1/releases) | Latest upstream release |
65+
| `:pkg` | `net-p2p/sonarr` | FreeBSD quarterly packages |
66+
| `:pkg-latest` | `net-p2p/sonarr` | FreeBSD latest packages |
67+
68+
## Environment Variables
69+
70+
| Variable | Default | Description |
71+
|----------|---------|-------------|
72+
| `PUID` | 1000 | User ID for app |
73+
| `PGID` | 1000 | Group ID for app |
74+
| `TZ` | UTC | Timezone |
75+
76+
## Volumes
77+
78+
| Path | Description |
79+
|------|-------------|
80+
| `/config` | Configuration directory |
81+
| `/tv` | TV show library |
82+
| `/downloads` | Download directory |
83+
84+
## Ports
85+
86+
| Port | Description |
87+
|------|-------------|
88+
| 8989 | Web UI |
89+
90+
## Notes
91+
92+
- **User:** `bsd` (UID/GID set via PUID/PGID, default 1000)
93+
- **Base:** Built on `ghcr.io/daemonless/base-image` (FreeBSD)
94+
95+
### Specific Requirements
96+
- **.NET App:** Requires `--annotation 'org.freebsd.jail.allow.mlock=true'` (Requires [patched ocijail](https://github.com/daemonless/daemonless#ocijail-patch))
97+
98+
## Links
99+
100+
- [Website](https://sonarr.tv/)
101+
- [FreshPorts](https://www.freshports.org/net-p2p/sonarr/)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
# Set up sonarr user and config directory
3+
4+
PUID=${PUID:-1000}
5+
PGID=${PGID:-1000}
6+
7+
echo "[sonarr] Setting up sonarr user with PUID=$PUID PGID=$PGID"
8+
9+
# Modify sonarr user/group to match requested UID/GID
10+
pw groupmod sonarr -g "$PGID" 2>/dev/null || true
11+
12+
# Ensure config directory has correct ownership
13+
chown -R bsd:bsd /config
14+
15+
echo "[sonarr] Configuration complete"

0 commit comments

Comments
 (0)