Spaces:
Running
Running
FROM ubuntu:22.04 | |
# Install necessary tools | |
RUN apt-get update && apt-get install -y \ | |
tar \ | |
gzip \ | |
file \ | |
jq \ | |
curl \ | |
sed \ | |
aria2 \ | |
unzip \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set up a new user named "user" with user ID 1000 | |
RUN useradd -m -u 1000 user | |
# Switch to the "user" user | |
USER user | |
# Set home to the user's home directory | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Set the working directory to the user's home directory | |
WORKDIR $HOME/alist | |
RUN mkdir -p $HOME/alist/data | |
#download cfg and unzip | |
#RUN curl -L -o cfga.zip https://github.com/twhite-gh/twhite-gh/raw/refs/heads/main/cfga.zip | |
#RUN --mount=type=secret,id=ZIP_PWD,mode=0444,required=true unzip -P $(cat /run/secrets/ZIP_PWD) cfga.zip | |
#RUN cp -f config.json $HOME/alist/data/config.json | |
COPY --chown=user . $HOME/alist | |
RUN --mount=type=secret,id=ZIP_PWD,mode=0444,required=true cd $HOME/alist && unzip -P $(cat /run/secrets/ZIP_PWD) cfga.zip | |
RUN cd $HOME/alist && cp -f config.json $HOME/alist/data/config.json | |
RUN cat $HOME/alist/data/config.json | |
RUN chmod +x $HOME/alist/tvbox | |
# CMD ["bash", "alist", "server"] | |
#CMD cd $HOME/alist && ./tvbox server | |
#EXPOSE 5244 | |
# Create a startup script that runs Alist and Aria2 | |
RUN echo '#!/bin/bash\n\ | |
aria2c --enable-rpc --rpc-listen-all --rpc-allow-origin-all --rpc-listen-port=6800 --daemon\n\ | |
rm -rf /var/lib/apt/lists/* \n\ | |
/home/user/alist/tvbox server --data /home/user/alist/data/' > $HOME/alist/start.sh && \ | |
chmod +x $HOME/alist/start.sh | |
RUN cat $HOME/alist/data/config.json | |
RUN cat $HOME/alist/start.sh | |
# Set the command to run when the container starts | |
CMD ["/bin/bash", "-c", "/home/user/alist/start.sh"] | |
# Expose the default Alist port | |
EXPOSE 5244 6800 |