Spaces:
Paused
Paused
| FROM nikolaik/python-nodejs:python3.11-nodejs18 | |
| ENV USERNAME=admin | |
| # Create and use a non-root user | |
| RUN useradd -ms /bin/bash $USERNAME | |
| WORKDIR /app | |
| # install required packages in one layer | |
| RUN apt-get update -y && apt-get upgrade -y \ | |
| && apt-get install -y --no-install-recommends ffmpeg git-all \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| ENV HOME=/home/$USERNAME | |
| RUN mkdir -p $HOME/.cache $HOME/.config \ | |
| && chmod -R 777 $HOME | |
| ENV PATH=$HOME/.local/bin:$PATH | |
| # copy init script | |
| COPY init.sh /app/init.sh | |
| # Ensure line endings are unix-style and script is executable, then run it | |
| RUN sed -i 's/\r$//' /app/init.sh \ | |
| && chmod +x /app/init.sh \ | |
| && echo "---- init.sh head ----" && head -n 3 /app/init.sh || true \ | |
| && /bin/bash /app/init.sh | |
| # Set ownership and permissions for the app directory | |
| RUN chown -R admin:admin /app && chmod -R 777 /app | |
| # Switch to non-root user | |
| USER admin | |
| EXPOSE 7860 | |
| ENTRYPOINT ["/app/init.sh"] | |
| CMD ["python", "-u", "-m", "YukkiMusic"] | |