86 lines
2.2 KiB
Docker
Executable File
86 lines
2.2 KiB
Docker
Executable File
# syntax=docker/dockerfile:1
|
|
|
|
#===========================
|
|
# Stage 1: Build Prowlarr from source
|
|
#===========================
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache \
|
|
bash \
|
|
git \
|
|
curl \
|
|
icu-libs \
|
|
nodejs \
|
|
npm \
|
|
yarn
|
|
|
|
# Arguments for upstream source
|
|
ARG PROWLARR_BRANCH="develop"
|
|
ARG PROWLARR_REPO="https://github.com/Prowlarr/Prowlarr.git"
|
|
|
|
WORKDIR /src
|
|
|
|
# Clone upstream Prowlarr
|
|
RUN git clone --depth 1 --branch "${PROWLARR_BRANCH}" "${PROWLARR_REPO}" .
|
|
|
|
# Copy and apply patches
|
|
COPY patches/ /tmp/patches/
|
|
RUN git config user.email "build@local" && \
|
|
git config user.name "Build" && \
|
|
git am /tmp/patches/*.patch
|
|
|
|
# Install frontend dependencies and build
|
|
RUN yarn install --frozen-lockfile --network-timeout 120000
|
|
RUN yarn run build --env production
|
|
|
|
# Build backend for linux-musl-x64 (Alpine)
|
|
RUN bash build.sh --backend -r linux-musl-x64 -f net8.0
|
|
|
|
# Package
|
|
RUN bash build.sh --packages -r linux-musl-x64 -f net8.0
|
|
|
|
#===========================
|
|
# Stage 2: Runtime
|
|
#===========================
|
|
FROM ghcr.io/linuxserver/baseimage-alpine:3.23
|
|
|
|
# set version label
|
|
ARG BUILD_DATE
|
|
ARG VERSION
|
|
ARG PROWLARR_BRANCH="develop"
|
|
LABEL build_version="Custom build version:- ${VERSION} Build-date:- ${BUILD_DATE}"
|
|
LABEL maintainer="romain"
|
|
|
|
# environment settings
|
|
ENV XDG_CONFIG_HOME="/config/xdg" \
|
|
COMPlus_EnableDiagnostics=0 \
|
|
TMPDIR=/run/prowlarr-temp
|
|
|
|
RUN \
|
|
echo "**** install runtime packages ****" && \
|
|
apk add -U --upgrade --no-cache \
|
|
icu-libs \
|
|
sqlite-libs \
|
|
xmlstarlet
|
|
|
|
# Copy compiled Prowlarr from build stage
|
|
RUN mkdir -p /app/prowlarr/bin
|
|
COPY --from=build /src/_artifacts/linux-musl-x64/net8.0/Prowlarr/ /app/prowlarr/bin/
|
|
|
|
# Write package info
|
|
RUN echo -e "UpdateMethod=docker\nBranch=${PROWLARR_BRANCH}\nPackageVersion=${VERSION}\nPackageAuthor=custom-build" > /app/prowlarr/package_info && \
|
|
printf "Custom build version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
|
|
echo "**** cleanup ****" && \
|
|
rm -rf \
|
|
/app/prowlarr/bin/Prowlarr.Update \
|
|
/tmp/* \
|
|
/var/tmp/*
|
|
|
|
# copy local files (s6 services)
|
|
COPY root/ /
|
|
|
|
# ports and volumes
|
|
EXPOSE 9696
|
|
VOLUME /config
|