forked from sureshfizzy/CineSync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
79 lines (61 loc) · 2.26 KB
/
Dockerfile
File metadata and controls
79 lines (61 loc) · 2.26 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
# ---- STAGE 1: Build WebDavHub ----
FROM python:3.11-slim AS builder
# Set the working directory inside the container
WORKDIR /app
# Install build dependencies
RUN apt-get update && \
apt-get install -y inotify-tools bash curl git gcc g++ make && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Install Go (Dynamic architecture detection)
ENV GO_VERSION=1.21.0
RUN ARCH=$(dpkg --print-architecture) && \
case "$ARCH" in \
amd64) GOARCH="linux-amd64";; \
arm64) GOARCH="linux-arm64";; \
armhf) GOARCH="linux-armv6l";; \
*) echo "Unsupported architecture: $ARCH"; exit 1;; \
esac && \
curl -fsSL https://go.dev/dl/go${GO_VERSION}.${GOARCH}.tar.gz | tar -C /usr/local -xz
ENV PATH="/usr/local/go/bin:${PATH}"
ENV GOPATH=/go
ENV PATH="${GOPATH}/bin:${PATH}"
# Install pnpm globally
RUN npm install -g pnpm
# Copy WebDavHub and build
COPY WebDavHub /app/WebDavHub
WORKDIR /app/WebDavHub
# Build using the production build script
RUN python3 scripts/build-prod.py
# ---- STAGE 2: Final Runtime Image ----
FROM python:3.11-slim
# Install required system packages
RUN apt-get update && \
apt-get install -y inotify-tools bash gosu curl psmisc ffmpeg rclone fuse3 && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Install pnpm globally
RUN npm install -g pnpm
# Copy Python dependencies and install
COPY requirements.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/requirements.txt && rm /tmp/requirements.txt
# Set default PUID and PGID
ENV PUID=1000
ENV PGID=1000
# Create default user and group
RUN groupadd -g ${PGID} appuser && \
useradd -u ${PUID} -g appuser -d /app -s /bin/bash appuser
# Copy application files
COPY MediaHub /app/MediaHub
COPY --from=builder /app/WebDavHub /app/WebDavHub
# Add the entrypoint script
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
# Set working directory
WORKDIR /app
# Enable allow_other for FUSE inside the container
RUN echo 'user_allow_other' >> /etc/fuse.conf || true
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["python3", "WebDavHub/scripts/start-prod.py"]