Skip to content

Commit bdbf352

Browse files
committed
Merge branch 'develop'
2 parents e238225 + 0652e1b commit bdbf352

File tree

3 files changed

+40
-36
lines changed

3 files changed

+40
-36
lines changed

Diff for: Dockerfile

+19-26
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
1-
FROM golang:1.18 as builder
2-
3-
# Build the normal executable
4-
RUN mkdir /build
5-
COPY . /build
6-
WORKDIR /build
7-
RUN CGO_ENABLED=0 go build -a -v -mod vendor -ldflags "-s -w" -o sensibleHub .
8-
9-
10-
# Now for the image we actually run the server in
11-
FROM python:3-alpine
12-
13-
# Install ffmpeg
14-
RUN apk add ca-certificates ffmpeg
15-
ENV PATH="/bin:${PATH}"
16-
17-
RUN apk add --no-cache --virtual .pynacl_deps build-base python3-dev libffi-dev
18-
19-
# Install youtube-dl
20-
RUN pip install yt-dlp
21-
22-
RUN apk del .pynacl_deps
23-
24-
# Copy main executable
25-
COPY --from=builder /build/sensibleHub .
26-
ENTRYPOINT [ "./sensibleHub", "-config", "/config/config.json" ]
1+
FROM golang:1.18 as builder
2+
3+
# Build the normal executable
4+
RUN mkdir /build
5+
COPY . /build
6+
WORKDIR /build
7+
RUN CGO_ENABLED=0 go build -a -v -mod vendor -ldflags "-s -w" -o sensibleHub .
8+
9+
10+
# Now for the image we actually run the server in
11+
FROM alpine:latest
12+
RUN apk add ca-certificates ffmpeg python3
13+
# Copy main executable
14+
COPY --from=builder /build/sensibleHub .
15+
# Download yt-dlp
16+
RUN wget -qO /bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp && chmod +x /bin/yt-dlp
17+
ENV PATH="/bin:${PATH}"
18+
ENV RUNNING_IN_DOCKER=true
19+
ENTRYPOINT [ "./sensibleHub", "-config", "/config/config.json" ]

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ If you prefer using Docker, you can run the following in a directory that contai
6161

6262
docker run -v"$(pwd):/config" -v"$(pwd)/data:/data" -p 128:128 -p 1280:1280 ghcr.io/xarantolus/sensiblehub:master
6363

64+
The volume mounted at `/config` must contain a `config.json` file. To change the exposed ports, you can modify the first port (before the `:`) in the command to another port. If you didn't change the configuration file `128` is the default HTTP port, `1280` is used for FTP.
65+
6466
<details>
6567
<summary>If no recent build is available, you can also build for yourself.</summary>
6668

Diff for: store/config/config.go

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package config
22

33
import (
4+
"log"
45
"os"
56
"strings"
67

@@ -53,18 +54,26 @@ func Parse(path string) (c Config, err error) {
5354
return
5455
}
5556

56-
// Set default paths/names if none are set
57-
c.Alternatives.FFmpeg = strings.TrimSpace(c.Alternatives.FFmpeg)
58-
if c.Alternatives.FFmpeg == "" {
57+
rid, ok := os.LookupEnv("RUNNING_IN_DOCKER")
58+
if ok && strings.ToLower(rid) == "true" {
5959
c.Alternatives.FFmpeg = "ffmpeg"
60-
}
61-
c.Alternatives.FFprobe = strings.TrimSpace(c.Alternatives.FFprobe)
62-
if c.Alternatives.FFprobe == "" {
6360
c.Alternatives.FFprobe = "ffprobe"
64-
}
65-
c.Alternatives.YoutubeDL = strings.TrimSpace(c.Alternatives.YoutubeDL)
66-
if c.Alternatives.YoutubeDL == "" {
67-
c.Alternatives.YoutubeDL = "youtube-dl"
61+
c.Alternatives.YoutubeDL = "yt-dlp"
62+
log.Println("[Info] Running in Docker, using local binaries. This means that the \"alternatives\" config part is ignored!")
63+
} else {
64+
// Set default paths/names if none are set
65+
c.Alternatives.FFmpeg = strings.TrimSpace(c.Alternatives.FFmpeg)
66+
if c.Alternatives.FFmpeg == "" {
67+
c.Alternatives.FFmpeg = "ffmpeg"
68+
}
69+
c.Alternatives.FFprobe = strings.TrimSpace(c.Alternatives.FFprobe)
70+
if c.Alternatives.FFprobe == "" {
71+
c.Alternatives.FFprobe = "ffprobe"
72+
}
73+
c.Alternatives.YoutubeDL = strings.TrimSpace(c.Alternatives.YoutubeDL)
74+
if c.Alternatives.YoutubeDL == "" {
75+
c.Alternatives.YoutubeDL = "youtube-dl"
76+
}
6877
}
6978

7079
return

0 commit comments

Comments
 (0)