Code-Server_IDE / Dockerfile
NitinBot002's picture
Update Dockerfile
2bf003e verified
raw
history blame
1.77 kB
# Use the official code-server base image
FROM codercom/code-server:latest
# Switch to root to install system packages
USER root
# Install Python 3.10, pip, build tools, Node.js 18, and other essentials
RUN apt-get update && \
apt-get install -y software-properties-common curl gnupg lsb-release && \
add-apt-repository -y ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y \
python3.10 \
python3.10-venv \
python3.10-dev \
python3-pip \
build-essential \
git \
wget \
unzip \
nano \
zip \
ca-certificates \
net-tools \
xz-utils \
openssh-client && \
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs && \
npm install -g npm yarn && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Upgrade pip and install Python tools globally
RUN pip3 install --no-cache-dir --upgrade pip setuptools wheel \
&& pip3 install --no-cache-dir ipython virtualenv jupyter
# Create a project directory and set permissions
RUN mkdir -p /home/coder/project && chown -R coder:coder /home/coder/project
# Switch back to coder user
USER coder
# Set ENV vars
ENV PASSWORD=hfspacespassword
ENV PORT=7860
ENV HOME=/home/coder
# Set up code-server config
RUN mkdir -p ~/.config/code-server && \
echo '{ \
"bind-addr": "0.0.0.0:7860", \
"auth": "password", \
"password": "'"${PASSWORD}"'", \
"cert": false \
}' > ~/.config/code-server/config.json
# Set working directory
WORKDIR /home/coder/project
# Expose Hugging Face port
EXPOSE 7860
# Launch code-server
CMD ["code-server", "--port", "7860", "/home/coder/project"]