69 lines
1.8 KiB
Docker
69 lines
1.8 KiB
Docker
# ---- Stage 1: Build Frontend ----
|
|
FROM node:22-alpine AS frontend-builder
|
|
WORKDIR /frontend
|
|
COPY frontend/package*.json ./
|
|
RUN npm install
|
|
COPY frontend .
|
|
RUN npm run build
|
|
|
|
# ---- Stage 2: Final Image ----
|
|
FROM savonet/liquidsoap:v2.2.5
|
|
|
|
# Switch to root to install packages
|
|
USER root
|
|
|
|
# Install required packages
|
|
# - icecast2: streaming server
|
|
# - supervisor: process manager
|
|
# - python3-venv, python3-pip: for the backend
|
|
# - ffmpeg, libsndfile1: backend audio processing
|
|
RUN apt-get update && apt-get install -y \
|
|
icecast2 \
|
|
supervisor \
|
|
python3 \
|
|
python3-venv \
|
|
python3-pip \
|
|
ffmpeg \
|
|
libsndfile1 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set up Icecast directories and permissions
|
|
RUN mkdir -p /var/log/icecast2 /etc/icecast2 /var/run/icecast2 \
|
|
&& chown -R liquidsoap:liquidsoap /var/log/icecast2 /etc/icecast2 /var/run/icecast2
|
|
|
|
COPY icecast.xml /etc/icecast2/icecast.xml
|
|
|
|
# Prepare python environment
|
|
WORKDIR /app
|
|
RUN python3 -m venv /opt/venv
|
|
ENV PATH="/opt/venv/bin:$PATH"
|
|
|
|
COPY app/requirements.txt /app/
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy backend code
|
|
COPY app /app/app
|
|
|
|
# Copy liquidsoap config
|
|
COPY liquidsoap /app/liquidsoap
|
|
|
|
# Copy built frontend from Stage 1
|
|
COPY --from=frontend-builder /frontend/dist /app/frontend/dist
|
|
|
|
# Copy supervisord config
|
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
# Give liquidsoap user permissions to /app and /data
|
|
RUN mkdir -p /data \
|
|
&& chown -R liquidsoap:liquidsoap /app /data /opt/venv
|
|
|
|
# Copy entrypoint script
|
|
COPY docker-entrypoint.sh /usr/local/bin/
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
# Expose required ports: 8080 (API/Web UI), 8000 (Icecast)
|
|
EXPOSE 8080 8000
|
|
|
|
# Start via entrypoint (runs as root to fix permissions, then starts supervisord)
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|