fixed docker ffmpeg
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -8,7 +8,9 @@ WORKDIR /app
|
|||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
build-essential \
|
build-essential \
|
||||||
gosu \
|
gosu \
|
||||||
|
git \
|
||||||
redis-server \
|
redis-server \
|
||||||
|
ffmpeg \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
@@ -21,8 +23,9 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
# Copy application code
|
# Copy application code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Create necessary directories
|
# Create necessary directories with proper permissions
|
||||||
RUN mkdir -p downloads config creds
|
RUN mkdir -p downloads config creds logs && \
|
||||||
|
chmod 777 downloads config creds logs
|
||||||
|
|
||||||
# Make entrypoint script executable
|
# Make entrypoint script executable
|
||||||
RUN chmod +x entrypoint.sh
|
RUN chmod +x entrypoint.sh
|
||||||
@@ -30,5 +33,4 @@ RUN chmod +x entrypoint.sh
|
|||||||
# Set entrypoint to our script
|
# Set entrypoint to our script
|
||||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
|
|
||||||
# Default command (empty as entrypoint will handle the default behavior)
|
# No CMD needed as entrypoint.sh handles application startup
|
||||||
CMD []
|
|
||||||
|
|||||||
@@ -1,33 +1,20 @@
|
|||||||
name: spotizerr
|
name: spotizerr
|
||||||
|
|
||||||
services:
|
services:
|
||||||
redis:
|
|
||||||
image: redis:alpine
|
|
||||||
container_name: spotizerr-redis
|
|
||||||
restart: unless-stopped
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 3
|
|
||||||
|
|
||||||
spotizerr:
|
spotizerr:
|
||||||
volumes:
|
volumes:
|
||||||
- ./creds:/app/creds
|
- ./creds:/app/creds
|
||||||
- ./config:/app/config
|
- ./config:/app/config
|
||||||
- ./downloads:/app/downloads # <-- Change this for your music library dir
|
- ./downloads:/app/downloads # <-- Change this for your music library dir
|
||||||
|
- ./logs:/app/logs # <-- Volume for persistent logs
|
||||||
ports:
|
ports:
|
||||||
- 7171:7171
|
- 7171:7171
|
||||||
image: cooldockerizer93/spotizerr
|
image: spotizerr:dev
|
||||||
container_name: spotizerr-app
|
container_name: spotizerr-app
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
|
||||||
redis:
|
|
||||||
condition: service_healthy
|
|
||||||
environment:
|
environment:
|
||||||
- PUID=1000 # Replace with your desired user ID | Remove both if you want to run as root (not recommended, might result in unreadable files)
|
- PUID=1000 # Replace with your desired user ID | Remove both if you want to run as root (not recommended, might result in unreadable files)
|
||||||
- PGID=1000 # Replace with your desired group ID | The user must have write permissions in the volume mapped to /app/downloads
|
- PGID=1000 # Replace with your desired group ID | The user must have write permissions in the volume mapped to /app/downloads
|
||||||
- UMASK=0022 # Optional: Sets the default file permissions for newly created files within the container.
|
- UMASK=0022 # Optional: Sets the default file permissions for newly created files within the container.
|
||||||
- MAX_CONCURRENT_DL=3 # Optional: Set the number of concurrent downloads allowed
|
- REDIS_URL=redis://localhost:6379/0
|
||||||
- REDIS_URL=redis://redis:6379/0
|
- REDIS_BACKEND=redis://localhost:6379/0
|
||||||
- REDIS_BACKEND=redis://redis:6379/0
|
|
||||||
|
|||||||
@@ -6,10 +6,37 @@ if [ -n "${UMASK}" ]; then
|
|||||||
umask "${UMASK}"
|
umask "${UMASK}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if Redis should be started locally
|
||||||
|
if [[ -z "${REDIS_URL}" || "${REDIS_URL}" == *"localhost"* || "${REDIS_URL}" == *"127.0.0.1"* ]]; then
|
||||||
|
echo "Starting local Redis server..."
|
||||||
|
redis-server --daemonize yes
|
||||||
|
# Wait for Redis to be ready
|
||||||
|
until redis-cli ping &>/dev/null; do
|
||||||
|
echo "Waiting for Redis to start..."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo "Redis server is running."
|
||||||
|
|
||||||
|
# If REDIS_URL is not set, set it to localhost
|
||||||
|
if [ -z "${REDIS_URL}" ]; then
|
||||||
|
export REDIS_URL="redis://localhost:6379/0"
|
||||||
|
echo "Set REDIS_URL to ${REDIS_URL}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If REDIS_BACKEND is not set, set it to the same as REDIS_URL
|
||||||
|
if [ -z "${REDIS_BACKEND}" ]; then
|
||||||
|
export REDIS_BACKEND="${REDIS_URL}"
|
||||||
|
echo "Set REDIS_BACKEND to ${REDIS_BACKEND}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Using external Redis server at ${REDIS_URL}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if both PUID and PGID are not set
|
# Check if both PUID and PGID are not set
|
||||||
if [ -z "${PUID}" ] && [ -z "${PGID}" ]; then
|
if [ -z "${PUID}" ] && [ -z "${PGID}" ]; then
|
||||||
# Run as root directly
|
# Run as root directly
|
||||||
exec "$@"
|
echo "Running as root user (no PUID/PGID specified)"
|
||||||
|
exec python app.py
|
||||||
else
|
else
|
||||||
# Verify both PUID and PGID are set
|
# Verify both PUID and PGID are set
|
||||||
if [ -z "${PUID}" ] || [ -z "${PGID}" ]; then
|
if [ -z "${PUID}" ] || [ -z "${PGID}" ]; then
|
||||||
@@ -19,32 +46,39 @@ else
|
|||||||
|
|
||||||
# Check for root user request
|
# Check for root user request
|
||||||
if [ "${PUID}" -eq 0 ] && [ "${PGID}" -eq 0 ]; then
|
if [ "${PUID}" -eq 0 ] && [ "${PGID}" -eq 0 ]; then
|
||||||
exec "$@"
|
echo "Running as root user (PUID/PGID=0)"
|
||||||
|
exec python app.py
|
||||||
else
|
else
|
||||||
# Check if the group with the specified GID already exists
|
# Check if the group with the specified GID already exists
|
||||||
if getent group "${PGID}" >/dev/null; then
|
if getent group "${PGID}" >/dev/null; then
|
||||||
# If the group exists, use its name instead of creating a new one
|
# If the group exists, use its name instead of creating a new one
|
||||||
GROUP_NAME=$(getent group "${PGID}" | cut -d: -f1)
|
GROUP_NAME=$(getent group "${PGID}" | cut -d: -f1)
|
||||||
|
echo "Using existing group: ${GROUP_NAME} (GID: ${PGID})"
|
||||||
else
|
else
|
||||||
# If the group doesn't exist, create it
|
# If the group doesn't exist, create it
|
||||||
GROUP_NAME="appgroup"
|
GROUP_NAME="appgroup"
|
||||||
groupadd -g "${PGID}" "${GROUP_NAME}"
|
groupadd -g "${PGID}" "${GROUP_NAME}"
|
||||||
|
echo "Created group: ${GROUP_NAME} (GID: ${PGID})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the user with the specified UID already exists
|
# Check if the user with the specified UID already exists
|
||||||
if getent passwd "${PUID}" >/dev/null; then
|
if getent passwd "${PUID}" >/dev/null; then
|
||||||
# If the user exists, use its name instead of creating a new one
|
# If the user exists, use its name instead of creating a new one
|
||||||
USER_NAME=$(getent passwd "${PUID}" | cut -d: -f1)
|
USER_NAME=$(getent passwd "${PUID}" | cut -d: -f1)
|
||||||
|
echo "Using existing user: ${USER_NAME} (UID: ${PUID})"
|
||||||
else
|
else
|
||||||
# If the user doesn't exist, create it
|
# If the user doesn't exist, create it
|
||||||
USER_NAME="appuser"
|
USER_NAME="appuser"
|
||||||
useradd -u "${PUID}" -g "${GROUP_NAME}" -d /app "${USER_NAME}"
|
useradd -u "${PUID}" -g "${GROUP_NAME}" -d /app "${USER_NAME}"
|
||||||
|
echo "Created user: ${USER_NAME} (UID: ${PUID})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure proper permissions
|
# Ensure proper permissions for all app directories
|
||||||
chown -R "${USER_NAME}:${GROUP_NAME}" /app || true
|
echo "Setting permissions for /app directories..."
|
||||||
|
chown -R "${USER_NAME}:${GROUP_NAME}" /app/downloads /app/config /app/creds /app/logs || true
|
||||||
|
|
||||||
# Run as specified user
|
# Run as specified user
|
||||||
exec gosu "${USER_NAME}" "$@"
|
echo "Starting application as ${USER_NAME}..."
|
||||||
|
exec gosu "${USER_NAME}" python app.py
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
Reference in New Issue
Block a user