Spaces:
Running
Running
File size: 3,376 Bytes
fd44f08 536674f 34f20c9 c882607 34f20c9 56a2e7f 29a694b 56a2e7f 536674f 56a2e7f e14fa14 56a2e7f 395e2ab fb90b7f d675ce2 a009b66 aedbe8b a009b66 a754679 a009b66 d675ce2 a009b66 9c7254b e4163c8 29c9a53 e4163c8 610727e e4163c8 ef41291 |
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
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
COPY --chown=user . $HOME/alist
#use auto gen cfg file start
RUN --mount=type=secret,id=MYSQL_HOST,mode=0444,required=true \
--mount=type=secret,id=MYSQL_PORT,mode=0444,required=true \
--mount=type=secret,id=MYSQL_USER,mode=0444,required=true \
--mount=type=secret,id=MYSQL_PASSWORD,mode=0444,required=true \
--mount=type=secret,id=MYSQL_DATABASE,mode=0444,required=true \
ENV_MYSQL_HOST=$(cat /run/secrets/MYSQL_HOST) && \
ENV_MYSQL_PORT=$(cat /run/secrets/MYSQL_PORT) && \
ENV_MYSQL_USER=$(cat /run/secrets/MYSQL_USER) && \
ENV_MYSQL_PASSWORD=$(cat /run/secrets/MYSQL_PASSWORD) && \
ENV_MYSQL_DATABASE=$(cat /run/secrets/MYSQL_DATABASE) && \
echo "{\n\
\"force\": false,\n\
\"address\": \"0.0.0.0\",\n\
\"port\": 5244,\n\
\"scheme\": {\n\
\"https\": false,\n\
\"cert_file\": \"\",\n\
\"key_file\": \"\"\n\
},\n\
\"cache\": {\n\
\"expiration\": 60,\n\
\"cleanup_interval\": 120\n\
},\n\
\"database\": {\n\
\"type\": \"mysql\",\n\
\"host\": \"$ENV_MYSQL_HOST\",\n\
\"port\": $ENV_MYSQL_PORT,\n\
\"user\": \"$ENV_MYSQL_USER\",\n\
\"password\": \"$ENV_MYSQL_PASSWORD\",\n\
\"name\": \"$ENV_MYSQL_DATABASE\"\n\
}\n\
}" > $HOME/alist/test.json
#RUN --mount=type=secret,id=MYSQL_HOST,mode=0444,required=true \
# --mount=type=secret,id=MYSQL_PORT,mode=0444,required=true \
# --mount=type=secret,id=MYSQL_USER,mode=0444,required=true \
# --mount=type=secret,id=MYSQL_PASSWORD,mode=0444,required=true \
# --mount=type=secret,id=MYSQL_DATABASE,mode=0444,required=true \
# ENV_MYSQL_HOST=$(cat /run/secrets/MYSQL_HOST) && \
# ENV_MYSQL_PORT=$(cat /run/secrets/MYSQL_PORT) && \
# ENV_MYSQL_USER=$(cat /run/secrets/MYSQL_USER) && \
# ENV_MYSQL_PASSWORD=$(cat /run/secrets/MYSQL_PASSWORD) && \
# ENV_MYSQL_DATABASE=$(cat /run/secrets/MYSQL_DATABASE) && \
# sed -i "s/MYSQL_HOST/${ENV_MYSQL_HOST:-localhost}/g" $HOME/alist/test.json && \
# sed -i "s/MYSQL_PORT/${ENV_MYSQL_PORT:-3306}/g" $HOME/alist/test.json && \
# sed -i "s/MYSQL_USER/${ENV_MYSQL_USER:-root}/g" $HOME/alist/test.json && \
# sed -i "s/MYSQL_PASSWORD/${ENV_MYSQL_PASSWORD:-password}/g" $HOME/alist/test.json && \
# sed -i "s/MYSQL_DATABASE/${ENV_MYSQL_PASSWORD:-alist}/g" $HOME/alist/test.json
RUN cp -f $HOME/alist/test.json $HOME/alist/data/config.json
#end
RUN chmod +x $HOME/alist/tvbox
# 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\
/home/user/alist/tvbox server --data /home/user/alist/data/' > $HOME/alist/start.sh && \
chmod +x $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 |