File size: 727 Bytes
1e33fc5
322a554
b960254
 
ce5dee2
244b9a4
2aac6fe
b960254
266c1aa
2aac6fe
ce5dee2
 
2aac6fe
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
FROM ghcr.io/remsky/kokoro-fastapi-cpu:v0.2.0post3

# Switch to root so we can install packages
USER root
RUN apt-get update && apt-get install -y socat && rm -rf /var/lib/apt/lists/*

# Set the dynamic port; Spaces will set this environment variable, defaulting here to 8880
ENV PORT=8880

# Expose the dynamic port
EXPOSE ${PORT}

# Override any inherited ENTRYPOINT or CMD by using our own one-liner:
ENTRYPOINT ["/bin/sh", "-c", "\
    echo 'Starting uvicorn on port 8880...'; \
    uvicorn api.src.main:app --host 0.0.0.0 --port 8880 & \
    pid=\$!; \
    sleep 5; \
    echo 'Starting socat: forwarding incoming \$PORT (${PORT}) to 8880...'; \
    exec socat TCP-LISTEN:${PORT},reuseaddr,fork TCP:127.0.0.1:8880"]
CMD []