Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +64 -0
Dockerfile
CHANGED
@@ -34,11 +34,75 @@ RUN mkdir -p $HOME/alist/data
|
|
34 |
|
35 |
COPY --chown=user . $HOME/alist
|
36 |
|
|
|
37 |
RUN --mount=type=secret,id=ZIP_PWD,mode=0444,required=true cd $HOME/alist && unzip -P $(cat /run/secrets/ZIP_PWD) cfga.zip
|
38 |
RUN cd $HOME/alist && cp -f config.json $HOME/alist/data/config.json
|
39 |
|
40 |
RUN cat $HOME/alist/data/config.json
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
RUN chmod +x $HOME/alist/tvbox
|
43 |
#CMD ["bash", "/home/user/alist/tvbox", "server"]
|
44 |
#CMD cd $HOME/alist && ./tvbox server
|
|
|
34 |
|
35 |
COPY --chown=user . $HOME/alist
|
36 |
|
37 |
+
#use repo zip cfg file
|
38 |
RUN --mount=type=secret,id=ZIP_PWD,mode=0444,required=true cd $HOME/alist && unzip -P $(cat /run/secrets/ZIP_PWD) cfga.zip
|
39 |
RUN cd $HOME/alist && cp -f config.json $HOME/alist/data/config.json
|
40 |
|
41 |
RUN cat $HOME/alist/data/config.json
|
42 |
|
43 |
+
#use auto gen cfg file
|
44 |
+
RUN --mount=type=secret,id=MYSQL_HOST,mode=0444,required=true \
|
45 |
+
--mount=type=secret,id=MYSQL_PORT,mode=0444,required=true \
|
46 |
+
--mount=type=secret,id=MYSQL_USER,mode=0444,required=true \
|
47 |
+
--mount=type=secret,id=MYSQL_PASSWORD,mode=0444,required=true \
|
48 |
+
--mount=type=secret,id=MYSQL_DATABASE,mode=0444,required=true \
|
49 |
+
ENV_MYSQL_HOST=$(cat /run/secrets/MYSQL_HOST) && \
|
50 |
+
ENV_MYSQL_PORT=$(cat /run/secrets/MYSQL_PORT) && \
|
51 |
+
ENV_MYSQL_USER=$(cat /run/secrets/MYSQL_USER) && \
|
52 |
+
ENV_MYSQL_PASSWORD=$(cat /run/secrets/MYSQL_PASSWORD) && \
|
53 |
+
ENV_MYSQL_DATABASE=$(cat /run/secrets/MYSQL_DATABASE) && \
|
54 |
+
echo "{\n\
|
55 |
+
\"force\": false,\n\
|
56 |
+
\"address\": \"0.0.0.0\",\n\
|
57 |
+
\"port\": 5244,\n\
|
58 |
+
\"scheme\": {\n\
|
59 |
+
\"https\": false,\n\
|
60 |
+
\"cert_file\": \"\",\n\
|
61 |
+
\"key_file\": \"\"\n\
|
62 |
+
},\n\
|
63 |
+
\"cache\": {\n\
|
64 |
+
\"expiration\": 60,\n\
|
65 |
+
\"cleanup_interval\": 120\n\
|
66 |
+
},\n\
|
67 |
+
\"database\": {\n\
|
68 |
+
\"type\": \"mysql\",\n\
|
69 |
+
\"host\": \"$ENV_MYSQL_HOST\",\n\
|
70 |
+
\"port\": $ENV_MYSQL_PORT,\n\
|
71 |
+
\"user\": \"$ENV_MYSQL_USER\",\n\
|
72 |
+
\"password\": \"$ENV_MYSQL_PASSWORD\",\n\
|
73 |
+
\"name\": \"$ENV_MYSQL_DATABASE\"\n\
|
74 |
+
}\n\
|
75 |
+
}" > $HOME/alist/data/test.json
|
76 |
+
|
77 |
+
#download cfg and unzip
|
78 |
+
#RUN curl -L -o cfga.zip https://github.com/twhite-gh/twhite-gh/raw/refs/heads/main/cfga.zip
|
79 |
+
#RUN --mount=type=secret,id=ZIP_PWD,mode=0444,required=true unzip -P $(cat /run/secrets/ZIP_PWD) cfga.zip
|
80 |
+
#RUN cp -f config.json $HOME/alist/data/config.json
|
81 |
+
|
82 |
+
COPY --chown=user . $HOME/alist
|
83 |
+
|
84 |
+
RUN cat $HOME/alist/config.json
|
85 |
+
|
86 |
+
RUN --mount=type=secret,id=MYSQL_HOST,mode=0444,required=true \
|
87 |
+
--mount=type=secret,id=MYSQL_PORT,mode=0444,required=true \
|
88 |
+
--mount=type=secret,id=MYSQL_USER,mode=0444,required=true \
|
89 |
+
--mount=type=secret,id=MYSQL_PASSWORD,mode=0444,required=true \
|
90 |
+
--mount=type=secret,id=MYSQL_DATABASE,mode=0444,required=true \
|
91 |
+
ENV_MYSQL_HOST=$(cat /run/secrets/MYSQL_HOST) && \
|
92 |
+
ENV_MYSQL_PORT=$(cat /run/secrets/MYSQL_PORT) && \
|
93 |
+
ENV_MYSQL_USER=$(cat /run/secrets/MYSQL_USER) && \
|
94 |
+
ENV_MYSQL_PASSWORD=$(cat /run/secrets/MYSQL_PASSWORD) && \
|
95 |
+
ENV_MYSQL_DATABASE=$(cat /run/secrets/MYSQL_DATABASE) && \
|
96 |
+
sed -i "s/MYSQL_HOST/${ENV_MYSQL_HOST:-localhost}/g" $HOME/alist/test.json && \
|
97 |
+
sed -i "s/MYSQL_PORT/${ENV_MYSQL_PORT:-3306}/g" $HOME/alist/test.json && \
|
98 |
+
sed -i "s/MYSQL_USER/${ENV_MYSQL_USER:-root}/g" $HOME/alist/test.json && \
|
99 |
+
sed -i "s/MYSQL_PASSWORD/${ENV_MYSQL_PASSWORD:-password}/g" $HOME/alist/test.json && \
|
100 |
+
sed -i "s/MYSQL_DATABASE/${ENV_MYSQL_PASSWORD:-alist}/g" $HOME/alist/test.json
|
101 |
+
|
102 |
+
RUN cat $HOME/alist/test.json
|
103 |
+
|
104 |
+
#RUN cp -f $HOME/alist/test.json $HOME/alist/data/config.json
|
105 |
+
|
106 |
RUN chmod +x $HOME/alist/tvbox
|
107 |
#CMD ["bash", "/home/user/alist/tvbox", "server"]
|
108 |
#CMD cd $HOME/alist && ./tvbox server
|