Spaces:
Paused
Paused
File size: 1,978 Bytes
2d9a2cd ed0a9e1 2d9a2cd ed0a9e1 2d9a2cd 385f70a 2d9a2cd 385f70a 2d9a2cd 385f70a | 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 | FROM ghcr.io/coder/coder:latest
# Copy the custom entrypoint script
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
# Switch to root to set permissions
USER root
RUN chmod +x /usr/local/bin/entrypoint.sh
# Switch back to the default coder user
USER coder
# Set the working directory for Coder (optional, as Coder might set its own)
WORKDIR /home/coder
# Expose the port Coder will listen on (Hugging Face Spaces expects 7860)
# Coder server by default listens on 0.0.0.0:3000 if CODER_HTTP_ADDRESS is not set.
# Hugging Face Spaces will map its internal 7860 to the container's exposed port.
# We will rely on Hugging Face to map its required 7860 to Coder's default or configured port.
# For Hugging Face, the application in the container *must* listen on port 7860.
# So, we need to ensure Coder listens on 7860. The docs suggest CODER_HTTP_ADDRESS env var.
# Let's try setting CODER_HTTP_ADDRESS in entrypoint.sh or as an env var in Dockerfile if possible,
# or see if coder server has a flag for this in newer versions.
# For now, let's assume Coder will pick up a port or we configure it via ENV.
# The previous CMD was ["coder", "server", "--http-listen-addr", "0.0.0.0:7860"]
# The new Coder versions don't use --http-listen-addr.
# The documentation implies `coder server` alone should work, and it might listen on 0.0.0.0:3000 by default.
# Hugging Face Spaces requires the app to listen on 0.0.0.0:7860.
# We will set CODER_HTTP_ADDRESS="0.0.0.0:7860" as an environment variable in the Dockerfile.
ENV CODER_HTTP_ADDRESS="0.0.0.0:7860"
EXPOSE 7860
# Set the entrypoint to our custom script
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
# Default command to start Coder server.
# CODER_ACCESS_URL will be set by entrypoint.sh
# CODER_PG_CONNECTION_URL should be set as a secret in Hugging Face Space settings
# CODER_DATA_DIR should be set as an environment variable (e.g., /data/coder-data) in Hugging Face Space settings for persistence
CMD ["coder", "server"]
|