flzta commited on
Commit
fa882e9
·
verified ·
1 Parent(s): 376fe4b

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +41 -0
Dockerfile ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM alpine:latest
2
+
3
+ # 創建一個非 root 使用者
4
+ ARG USER_ID=1000
5
+ ARG GROUP_ID=1000
6
+ RUN addgroup -g $GROUP_ID appuser && \
7
+ adduser -u $USER_ID -G appuser -s /bin/sh -D appuser
8
+
9
+ WORKDIR /opt/cloudreve
10
+
11
+ ENV TZ=Asia/Shanghai
12
+
13
+ # 直接使用您提供的下載連結
14
+ RUN apk update && \
15
+ apk add --no-cache wget unzip python3 py3-pip bash tar gzip jq curl && \
16
+ rm -rf /var/cache/apk/*
17
+
18
+ RUN wget -O cloudreve.tar.gz "https://github.com/cloudreve/Cloudreve/releases/download/3.8.3/cloudreve_3.8.3_linux_amd64.tar.gz" && \
19
+ tar -zxvf cloudreve.tar.gz && \
20
+ rm cloudreve.tar.gz
21
+
22
+ RUN mkdir -p /opt/cloudreve/data
23
+
24
+ # 設定 /opt/cloudreve 的擁有者為非 root 使用者
25
+ RUN chown -R appuser:appuser /opt/cloudreve
26
+
27
+ ENV VIRTUAL_ENV=/opt/venv
28
+ RUN python3 -m venv $VIRTUAL_ENV
29
+ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
30
+ RUN pip install --no-cache-dir requests webdavclient3
31
+ RUN pip install --upgrade webdavclient3
32
+
33
+ COPY sync_data.sh /opt/cloudreve/
34
+ RUN chown appuser:appuser /opt/cloudreve/sync_data.sh
35
+ RUN chmod +x /opt/cloudreve/sync_data.sh
36
+
37
+ USER appuser
38
+
39
+ EXPOSE 5212
40
+
41
+ CMD ["/bin/sh", "-c", "/opt/cloudreve/cloudreve -c /opt/cloudreve/config.ini & /opt/cloudreve/sync_data.sh"]