FROM codercom/code-server:latest USER root #RUN apk add curl unzip # Environment variables that will be used by entrypoint or code-server # PASSWORD will be injected by Hugging Face Secrets # PORT is often set by Hugging Face Spaces (defaulting to 7860 if not set) ENV PORT=${PORT:-7860} ENV DEFAULT_WORKSPACE=/home/coder/project ENV USER_DATA_DIR=/home/coder/.local/share/code-server ENV EXTENSIONS_DIR=${USER_DATA_DIR}/extensions ENV CONFIG_DIR=/home/coder/.config/code-server # Copy the entrypoint script to a location accessible by the 'coder' user # The base image runs as 'coder' user. COPY --chown=coder:coder entrypoint.sh /home/coder/entrypoint.sh RUN chmod +x /home/coder/entrypoint.sh # Expose the port code-server will listen on EXPOSE ${PORT} # Set the entrypoint. The script will handle starting code-server. ENTRYPOINT ["/home/coder/entrypoint.sh"] # Default argument to the entrypoint, which can be the workspace to open. # The entrypoint script currently hardcodes this, but this is a common pattern. CMD ["/home/coder/project"]