test69 / Dockerfile
zyxciss's picture
Update Dockerfile
2aac6fe verified
raw
history blame contribute delete
727 Bytes
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 []