diff --git a/Dockerfile b/Dockerfile index 42f0d04..9c43c60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,21 +5,19 @@ ARG BUILDPLATFORM ARG VERSION ARG CHANNEL -# Set destination for COPY WORKDIR /app -# Download Go modules COPY go.mod go.sum ./ RUN go mod download -# Copy the source code. Note the slash at the end, as explained in -# https://docs.docker.com/reference/dockerfile/#copy ADD . . -# Build -RUN CGO_ENABLED=0 GOOS=$(echo $TARGETPLATFORM | cut -d '/' -f1) GOARCH=$(echo $TARGETPLATFORM | cut -d '/' -f2) go build -ldflags="-X github.com/sirrobot01/debrid-blackhole/pkg/version.Version=${VERSION} -X github.com/sirrobot01/debrid-blackhole/pkg/version.Channel=${CHANNEL}" -o /blackhole +RUN CGO_ENABLED=0 GOOS=$(echo $TARGETPLATFORM | cut -d '/' -f1) GOARCH=$(echo $TARGETPLATFORM | cut -d '/' -f2) go build \ + -ldflags="-X github.com/sirrobot01/debrid-blackhole/pkg/version.Version=${VERSION} -X github.com/sirrobot01/debrid-blackhole/pkg/version.Channel=${CHANNEL}" \ + -o /blackhole -RUN CGO_ENABLED=0 GOOS=$(echo $TARGETPLATFORM | cut -d '/' -f1) GOARCH=$(echo $TARGETPLATFORM | cut -d '/' -f2) go build -o /healthcheck cmd/healthcheck/main.go +RUN CGO_ENABLED=0 GOOS=$(echo $TARGETPLATFORM | cut -d '/' -f1) GOARCH=$(echo $TARGETPLATFORM | cut -d '/' -f2) go build \ + -o /healthcheck cmd/healthcheck/main.go FROM alpine as logsetup ARG PUID=1000 @@ -27,19 +25,16 @@ ARG PGID=1000 RUN addgroup -g $PGID appuser && \ adduser -D -u $PUID -G appuser appuser && \ mkdir -p /logs && \ - chown -R appuser:appuser /logs && \ - mkdir -p /app && \ - chown appuser:appuser /app + chmod 777 /logs && \ + touch /logs/decypharr.log && \ + chmod 666 /logs/decypharr.log FROM gcr.io/distroless/static-debian12:latest COPY --from=builder /blackhole /blackhole COPY --from=builder /healthcheck /healthcheck -COPY --from=builder /app/README.md /README.md COPY --from=logsetup /etc/passwd /etc/passwd COPY --from=logsetup /etc/group /etc/group COPY --from=logsetup /logs /logs -COPY --from=logsetup /app /app - ENV LOG_PATH=/logs @@ -51,5 +46,4 @@ USER appuser HEALTHCHECK CMD ["/healthcheck"] -# Run -CMD ["/blackhole", "--config", "/app/config.json"] +CMD ["/blackhole", "--config", "/app/config.json"] \ No newline at end of file diff --git a/pkg/qbit/server/ui_handlers.go b/pkg/qbit/server/ui_handlers.go index 07eb3fd..a1f1a99 100644 --- a/pkg/qbit/server/ui_handlers.go +++ b/pkg/qbit/server/ui_handlers.go @@ -113,7 +113,6 @@ func (u *uiHandler) ConfigHandler(w http.ResponseWriter, r *http.Request) { } func (u *uiHandler) handleGetArrs(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") common.JSONResponse(w, u.qbit.Arrs.GetAll(), http.StatusOK) } @@ -161,7 +160,6 @@ func (u *uiHandler) handleAddContent(w http.ResponseWriter, r *http.Request) { } func (u *uiHandler) handleCheckCached(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") _hashes := r.URL.Query().Get("hash") if _hashes == "" { http.Error(w, "No hashes provided", http.StatusBadRequest) @@ -242,12 +240,10 @@ func (u *uiHandler) handleRepairMedia(w http.ResponseWriter, r *http.Request) { func (u *uiHandler) handleGetVersion(w http.ResponseWriter, r *http.Request) { v := version.GetInfo() - w.Header().Set("Content-Type", "application/json") common.JSONResponse(w, v, http.StatusOK) } func (u *uiHandler) handleGetTorrents(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") common.JSONResponse(w, u.qbit.Storage.GetAll("", "", nil), http.StatusOK) } @@ -262,7 +258,6 @@ func (u *uiHandler) handleDeleteTorrent(w http.ResponseWriter, r *http.Request) } func (u *uiHandler) handleGetConfig(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") config := common.CONFIG arrCfgs := make([]common.ArrConfig, 0) for _, a := range u.qbit.Arrs.GetAll() { diff --git a/pkg/qbit/shared/qbit.go b/pkg/qbit/shared/qbit.go index e0dcaa0..71af370 100644 --- a/pkg/qbit/shared/qbit.go +++ b/pkg/qbit/shared/qbit.go @@ -35,7 +35,7 @@ func NewQBit(config *common.Config, deb *debrid.DebridService, logger zerolog.Lo DownloadFolder: cfg.DownloadFolder, Categories: cfg.Categories, Debrid: deb, - Storage: NewTorrentStorage("torrents.json"), + Storage: NewTorrentStorage("/app/torrents.json"), logger: logger, Arrs: arrs, RefreshInterval: refreshInterval,