Files
spotizerr-dev/Dockerfile
2025-06-11 12:02:18 +02:00

57 lines
1.5 KiB
Docker
Executable File

# Stage 1: TypeScript to JavaScript compilation
FROM node:22-slim AS typescript-builder
WORKDIR /app
COPY tsconfig.json .
COPY src/js ./src/js
RUN npm install -g typescript
RUN tsc
# Stage 2: Frontend build
FROM node:22-slim AS frontend-builder
WORKDIR /app/spotizerr-ui
RUN npm install -g pnpm
COPY spotizerr-ui/package.json spotizerr-ui/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY spotizerr-ui/. .
RUN pnpm build
# Stage 3: Final application image
FROM python:3.12-slim
# Set an environment variable for non-interactive frontend installation
ENV DEBIAN_FRONTEND=noninteractive
LABEL org.opencontainers.image.source="https://github.com/Xoconoch/spotizerr"
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gosu \
git \
ffmpeg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code (excluding UI source and TS source)
COPY . .
# Copy compiled assets from previous stages
COPY --from=typescript-builder /app/static/js ./static/js
COPY --from=frontend-builder /app/spotizerr-ui/dist ./spotizerr-ui/dist
# Create necessary directories with proper permissions
RUN mkdir -p downloads data/config data/creds data/watch data/history logs/tasks && \
chmod -R 777 downloads data logs
# Make entrypoint script executable
RUN chmod +x entrypoint.sh
# Set entrypoint to our script
ENTRYPOINT ["/app/entrypoint.sh"]