File size: 1,579 Bytes
9414fef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM soyorins/imageflow

ENV STORAGE_TYPE="local"
ENV LOCAL_STORAGE_PATH="/app/static/images"
ENV S3_ENDPOINT=""
ENV S3_REGION=""
ENV S3_ACCESS_KEY=""
ENV S3_SECRET_KEY=""
ENV S3_BUCKET=""
ENV CUSTOM_DOMAIN=""
ENV MAX_UPLOAD_COUNT="20"
ENV IMAGE_QUALITY="80"
ENV WORKER_THREADS="4"
ENV COMPRESSION_EFFORT="6"
ENV FORCE_LOSSLESS="false"

# WebDAV备份配置
ENV WEBDAV_URL=""
ENV WEBDAV_USERNAME=""
ENV WEBDAV_PASSWORD=""
ENV WEBDAV_BACKUP_PATH=""
ENV SYNC_INTERVAL="600"

# 安装WebDAV备份所需依赖
RUN apk add --no-cache python3 py3-pip curl tar shadow

# 确保目录存在并授予合适的权限
RUN mkdir -p /app/static/images/metadata \
    /app/static/images/original/landscape \
    /app/static/images/original/portrait \
    /app/static/images/landscape/webp \
    /app/static/images/landscape/avif \
    /app/static/images/portrait/webp \
    /app/static/images/portrait/avif \
    /app/static/images/gif

# 确保权限正确
RUN chmod -R 777 /app/static/images && \
    chown -R nobody:nobody /app/static/images

RUN touch /app/.env && chmod 666 /app/.env

ENV APP_DIR="/app"
ENV APP_NAME="image"
ENV APP_SUFFIX="flow"

# 安装Python依赖
RUN pip3 install --no-cache-dir requests webdavclient3 --break-system-packages

# 复制同步脚本到容器中
COPY sync_data.sh /app/
RUN chmod +x /app/sync_data.sh

# 创建专用用户运行应用
RUN adduser -D -u 1000 appuser
RUN chown -R appuser:appuser /app

# 设置工作目录
WORKDIR /app

# 使用CMD指令启动应用
CMD ["/bin/sh", "-c", "/app/sync_data.sh & sleep 30 && $APP_DIR/$APP_NAME$APP_SUFFIX"]