File size: 999 Bytes
7c0d62d
5e60232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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"]