File size: 1,520 Bytes
f3410f9
 
 
 
 
 
 
 
 
 
 
42dcb30
 
 
64fa5b0
 
3b301d1
 
 
 
42dcb30
3b301d1
64fa5b0
 
 
 
 
 
 
f3410f9
 
64fa5b0
42dcb30
 
3b301d1
42dcb30
 
 
64fa5b0
 
42dcb30
 
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
# =============================================================================
# Sub2API Hugging Face Space Dockerfile
# =============================================================================
# This Space deploys from the exported root filesystem tar generated by the
# EvfWorkSpace/sub2api project, then layers the Space-specific startup wrapper
# on top. Keep sub2api-hf-rootfs.tar in this repository root.
# =============================================================================

FROM scratch

ADD sub2api-hf-rootfs.tar /

USER root

RUN apk add --no-cache redis postgresql postgresql-client openssl tzdata su-exec python3 py3-bcrypt \
    && mv /app/sub2api /app/hub-gateway \
    && chmod +x /app/hub-gateway \
    && mkdir -p /tmp/gateway-data /tmp/gateway-redis /tmp/gateway-postgres \
    && chown -R sub2api:sub2api /tmp/gateway-data /tmp/gateway-redis \
    && chown -R postgres:postgres /tmp/gateway-postgres

ENV DATA_DIR=/tmp/gateway-data \
    SERVER_HOST=0.0.0.0 \
    SERVER_PORT=7860 \
    PORT=7860 \
    SERVER_MODE=release \
    GIN_MODE=release \
    AUTO_SETUP=true \
    DATABASE_SSLMODE=require \
    QUNYOU_SKILL_ROOT=/app/tools/qunyou_skill \
    QUNYOU_PYTHON=python3 \
    TZ=Asia/Shanghai

COPY start-space.sh /app/start-space.sh
RUN chmod +x /app/start-space.sh

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=5 \
    CMD wget -q -T 5 -O /dev/null http://localhost:${SERVER_PORT:-7860}/health || exit 1

ENTRYPOINT ["/app/start-space.sh"]