Nextcloud with FFmpeg and Network Tools

This commit is contained in:
root
2025-12-20 19:45:02 -08:00
commit c3f316b89f
2 changed files with 61 additions and 0 deletions

29
Dockerfile Normal file
View File

@@ -0,0 +1,29 @@
FROM nextcloud:latest
# Switch to root (Default is usually root, but good to be explicit for installation)
USER root
# 1. Install Dependencies
# We combine your media tools (ffmpeg, imagemagick) with the network tools (ifupdown, iproute2)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ffmpeg \
imagemagick \
ghostscript \
ifupdown \
iproute2 \
iputils-ping \
nano \
&& rm -rf /var/lib/apt/lists/*
# 2. Apply your permissions fix
RUN chown www-data:www-data /usr/local/etc/php/conf.d/
# 3. Add Networking Script
COPY start_network.sh /start_network.sh
RUN chmod +x /start_network.sh
# 4. Entrypoint
# We DO NOT switch to USER www-data here.
# We stay as root so start_network.sh can configure the IP address.
ENTRYPOINT ["/start_network.sh"]

32
start_network.sh Normal file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# --- CONFIGURATION ---
IP=${STATIC_IP:-"192.168.0.120/24"}
GW=${STATIC_GW:-"192.168.0.1"}
DNS=${STATIC_DNS:-"192.168.0.113"}
echo "--- Nextcloud Network Init ---"
echo "Using IP: $IP"
# 1. Generate Network Config
cat <<EOF > /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address $IP
gateway $GW
EOF
# 2. Set DNS
echo "nameserver $DNS" > /etc/resolv.conf
# 3. Start Network
sleep 5
ifup eth0
# 4. Launch Nextcloud
echo "--- Starting Nextcloud Entrypoint ---"
# This official script handles the user switch to www-data automatically
exec /entrypoint.sh apache2-foreground