File size: 1,476 Bytes
cdbeb18
0529ca6
 
 
 
 
 
 
9f59e8a
0529ca6
9f59e8a
ea59663
5eaca39
 
 
 
0529ca6
 
 
 
 
 
 
 
 
34b48e5
0529ca6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 代码来自 https://github.com/aigem/hf-nocodb
FROM nocodb/nocodb:latest

ARG NC_S3_REGION
ARG NC_S3_ENDPOINT
ARG NC_S3_ACCESS_KEY

RUN apk add --no-cache git \
    && git clone https://github.com/aigem/hf-nocodb.git /tmp/hf-nocodb \
    && cp /tmp/hf-nocodb/src/* /tmp/ \
    && cp /tmp/startup.sh /usr/src/appEntry/startup.sh \
    && chmod +x /usr/src/appEntry/startup.sh /tmp/s3_setup.sh /tmp/setup.sh && rm -rf /tmp/hf-nocodb

RUN --mount=type=secret,id=NC_S3_BUCKET_NAME,mode=0444,required=true \
    --mount=type=secret,id=NC_S3_ACCESS_SECRET,mode=0444,required=true \
    /tmp/setup.sh && /tmp/s3_setup.sh && rm /tmp/setup.sh /tmp/s3_setup.sh

USER nocodb

WORKDIR /usr/src/app

# 设置环境变量
ENV LITESTREAM_S3_SKIP_VERIFY=false \
    LITESTREAM_RETENTION=1440h \
    LITESTREAM_RETENTION_CHECK_INTERVAL=72h \
    LITESTREAM_SNAPSHOT_INTERVAL=12h \
    LITESTREAM_SYNC_INTERVAL=60s \
    NC_TOOL_DIR=/usr/app/data/ \
    NODE_ENV=production \
    PORT=7860 \
    NC_ALLOW_LOCAL_HOOKS=true \
    NC_REDIS_URL="redis://:redis_password@localhost:6379/4" \
    NC_S3_REGION=${NC_S3_REGION} \
    NC_S3_ENDPOINT=${NC_S3_ENDPOINT} \
    NC_S3_ACCESS_KEY=${NC_S3_ACCESS_KEY} \
    LITESTREAM_S3_REGION=${NC_S3_REGION} \
    LITESTREAM_S3_ENDPOINT=${NC_S3_ENDPOINT} \
    LITESTREAM_S3_ACCESS_KEY_ID=${NC_S3_ACCESS_KEY}

ENV $(source /etc/profile.d/s3_env.sh && env | grep '^S3_' | xargs)

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/usr/src/appEntry/startup.sh"]