Spaces:
Runtime error
Runtime error
| FROM python:3.10-bullseye | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV LIBRETIME_VERSION=4.5.0 | |
| ENV PYTHONUNBUFFERED=1 | |
| # Install System Dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| postgresql postgresql-contrib \ | |
| rabbitmq-server \ | |
| icecast2 \ | |
| liquidsoap \ | |
| nginx \ | |
| supervisor \ | |
| sudo \ | |
| curl \ | |
| git \ | |
| lsb-release \ | |
| locales \ | |
| make \ | |
| unzip \ | |
| php-fpm php-pgsql php-curl php-gd php-mbstring php-xml php-bcmath php-intl php-zip php-opcache \ | |
| gettext libpq-dev gcc libc6-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Generate Locale | |
| RUN echo "en_US.UTF_8 UTF-8" > /etc/locale.gen && locale-gen | |
| # Clone LibreTime | |
| RUN git clone --depth 1 --branch ${LIBRETIME_VERSION} https://github.com/libretime/libretime.git /usr/src/libretime | |
| WORKDIR /usr/src/libretime | |
| # Install Python Components | |
| # 1. Shared | |
| WORKDIR /usr/src/libretime/shared | |
| RUN pip install . | |
| # 2. API Client | |
| WORKDIR /usr/src/libretime/api-client | |
| RUN pip install . | |
| # 3. API | |
| WORKDIR /usr/src/libretime/api | |
| RUN pip install .[prod] | |
| # 4. Analyzer | |
| WORKDIR /usr/src/libretime/analyzer | |
| RUN pip install . | |
| # 5. Playout | |
| WORKDIR /usr/src/libretime/playout | |
| RUN pip install . | |
| # 6. Worker | |
| WORKDIR /usr/src/libretime/worker | |
| RUN pip install . | |
| # Legacy Setup | |
| WORKDIR /usr/src/libretime/legacy | |
| # Install composer | |
| RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
| RUN composer install --no-dev --no-interaction | |
| RUN make locale-build | |
| # Move Legacy to final location | |
| RUN mkdir -p /usr/share/libretime | |
| RUN cp -r /usr/src/libretime/legacy /usr/share/libretime/legacy | |
| # Config Setup | |
| RUN mkdir -p /etc/libretime /var/log/libretime /var/lib/libretime /srv/libretime | |
| # Nginx | |
| RUN rm /etc/nginx/sites-enabled/default | |
| COPY custom_nginx.conf /etc/nginx/custom_nginx.conf | |
| # Supervisor | |
| COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |
| # Start Script | |
| COPY start.sh /start.sh | |
| COPY config.yml.template /etc/libretime/config.yml.template | |
| RUN chmod +x /start.sh | |
| # User Setup | |
| RUN useradd -m -u 1000 user | |
| RUN mkdir -p /var/log/rabbitmq | |
| RUN chown -R user:user /var/lib/postgresql /var/lib/rabbitmq /var/log/rabbitmq /var/log/libretime /etc/libretime /var/lib/libretime /srv/libretime /var/lib/nginx /var/log/nginx /var/log/supervisor /var/run/postgresql /var/log/icecast2 | |
| # Ensure PHP run directory exists and is writable | |
| RUN mkdir -p /run/php && chown -R user:user /run/php | |
| # Fix PHP FPM config to run as user | |
| # Debian 11 uses /etc/php/7.4/fpm/pool.d/www.conf | |
| RUN sed -i 's/www-data/user/g' /etc/php/7.4/fpm/pool.d/www.conf | |
| # Fix Icecast config to disable changeowner | |
| RUN sed -i 's/<changeowner>/<!--<changeowner>/g' /etc/icecast2/icecast.xml | |
| RUN sed -i 's/<\/changeowner>/<\/changeowner>-->/g' /etc/icecast2/icecast.xml | |
| ENV RABBITMQ_NODENAME=rabbit@localhost | |
| EXPOSE 7860 | |
| USER user | |
| CMD ["/start.sh"] | |