File size: 1,053 Bytes
3ab24da
cbe9afa
 
 
4ea5c68
cbe9afa
3ab24da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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"]