Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
81 lines (63 loc) · 2.18 KB
/
Copy pathDockerfile
File metadata and controls
81 lines (63 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# syntax=docker/dockerfile:1
# Stage 1: Builder
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS builder
ARG VERSION
ARG BRANCH=develop
ARG BUILD_CONFIGURATION=Release
# Install build and runtime dependencies
RUN apk add --no-cache \
bash \
git \
icu-libs \
nodejs \
yarn \
coreutils
WORKDIR /src
# Copy source code
COPY . .
# Update version information
RUN if [ -n "$VERSION" ]; then \
sed -i "s/<AssemblyVersion>[0-9.*]\+<\/AssemblyVersion>/<AssemblyVersion>$VERSION<\/AssemblyVersion>/g" src/Directory.Build.props && \
sed -i "s/<AssemblyConfiguration>[\$()A-Za-z-]\+<\/AssemblyConfiguration>/<AssemblyConfiguration>${BRANCH}<\/AssemblyConfiguration>/g" src/Directory.Build.props && \
sed -i "s/<string>10.0.0.0<\/string>/<string>$VERSION<\/string>/g" distribution/osx/Readarr.app/Contents/Info.plist; \
fi
# Build everything (backend, frontend, packages)
RUN chmod +x build.sh && ./build.sh --all
# Stage 2: Final Runtime Image
FROM docker.io/library/alpine:3.22
ARG TARGETARCH
ARG VENDOR
ARG VERSION
ARG BRANCH=develop
ARG PackageOwner=faustvii
ARG PackageRepo=readarr
ENV COMPlus_EnableDiagnostics=0 \
READARR__UPDATE__BRANCH=${BRANCH}
USER root
WORKDIR /app
# Install runtime dependencies
RUN apk add --no-cache \
bash \
ca-certificates \
catatonit \
coreutils \
icu-libs \
libintl \
nano \
sqlite-libs \
tzdata \
&& mkdir -p /app/bin \
&& chown -R root:root /app && chmod -R 755 /app
# Copy the packaged application from the builder stage
COPY --from=builder /src/_artifacts/linux-musl-x64/net6.0/Readarr /app/bin/
# Remove updater if not needed
RUN rm -rf /app/bin/Readarr.Update
# Create package_info dynamically
RUN printf "UpdateMethod=docker\nBranch=%s\nPackageVersion=%s\nPackageAuthor=[%s](https://github.com/%s)\nPackageOwner=%s\nPackageRepo=%s\n" "${READARR__UPDATE__BRANCH}" "${VERSION}" "${VENDOR}" "${VENDOR}" "${PackageOwner}" "${PackageRepo}" > /app/package_info
# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
USER nobody:nogroup
WORKDIR /config
VOLUME ["/config"]
ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]