Update Dockerfile
Browse files- Dockerfile +48 -18
Dockerfile
CHANGED
|
@@ -1,34 +1,64 @@
|
|
| 1 |
-
#
|
| 2 |
FROM codercom/code-server:latest
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
ENV PASSWORD=hfspacespassword \
|
| 6 |
-
PORT=7860 \
|
| 7 |
-
HOME=/home/coder \
|
| 8 |
-
DOCKER_USER=coder
|
| 9 |
-
|
| 10 |
-
# Set user to root to install dependencies
|
| 11 |
USER root
|
| 12 |
|
| 13 |
-
# Install
|
| 14 |
-
RUN apt-get update &&
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
# Create project
|
| 17 |
RUN mkdir -p /home/coder/project && chown -R coder:coder /home/coder/project
|
| 18 |
|
| 19 |
# Switch back to coder user
|
| 20 |
USER coder
|
| 21 |
|
| 22 |
-
# Set
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
#
|
| 26 |
RUN mkdir -p ~/.config/code-server && \
|
| 27 |
-
echo '{
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
# Expose
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
-
#
|
| 34 |
CMD ["code-server", "--port", "7860", "/home/coder/project"]
|
|
|
|
| 1 |
+
# Use the official code-server base image
|
| 2 |
FROM codercom/code-server:latest
|
| 3 |
|
| 4 |
+
# Switch to root to install system packages
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
USER root
|
| 6 |
|
| 7 |
+
# Install Python 3.10, pip, build tools, Node.js 18, and other essentials
|
| 8 |
+
RUN apt-get update && \
|
| 9 |
+
apt-get install -y software-properties-common curl gnupg lsb-release && \
|
| 10 |
+
add-apt-repository -y ppa:deadsnakes/ppa && \
|
| 11 |
+
apt-get update && \
|
| 12 |
+
apt-get install -y \
|
| 13 |
+
python3.10 \
|
| 14 |
+
python3.10-venv \
|
| 15 |
+
python3.10-dev \
|
| 16 |
+
python3-pip \
|
| 17 |
+
build-essential \
|
| 18 |
+
git \
|
| 19 |
+
wget \
|
| 20 |
+
unzip \
|
| 21 |
+
nano \
|
| 22 |
+
zip \
|
| 23 |
+
ca-certificates \
|
| 24 |
+
net-tools \
|
| 25 |
+
xz-utils \
|
| 26 |
+
openssh-client && \
|
| 27 |
+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && \
|
| 28 |
+
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
| 29 |
+
apt-get install -y nodejs && \
|
| 30 |
+
npm install -g npm yarn && \
|
| 31 |
+
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 32 |
+
|
| 33 |
+
# Upgrade pip and install Python tools globally
|
| 34 |
+
RUN pip3 install --no-cache-dir --upgrade pip setuptools wheel \
|
| 35 |
+
&& pip3 install --no-cache-dir ipython virtualenv jupyter
|
| 36 |
|
| 37 |
+
# Create a project directory and set permissions
|
| 38 |
RUN mkdir -p /home/coder/project && chown -R coder:coder /home/coder/project
|
| 39 |
|
| 40 |
# Switch back to coder user
|
| 41 |
USER coder
|
| 42 |
|
| 43 |
+
# Set ENV vars
|
| 44 |
+
ENV PASSWORD=hfspacespassword
|
| 45 |
+
ENV PORT=7860
|
| 46 |
+
ENV HOME=/home/coder
|
| 47 |
|
| 48 |
+
# Set up code-server config
|
| 49 |
RUN mkdir -p ~/.config/code-server && \
|
| 50 |
+
echo '{ \
|
| 51 |
+
"bind-addr": "0.0.0.0:7860", \
|
| 52 |
+
"auth": "password", \
|
| 53 |
+
"password": "'"${PASSWORD}"'", \
|
| 54 |
+
"cert": false \
|
| 55 |
+
}' > ~/.config/code-server/config.json
|
| 56 |
+
|
| 57 |
+
# Set working directory
|
| 58 |
+
WORKDIR /home/coder/project
|
| 59 |
|
| 60 |
+
# Expose Hugging Face port
|
| 61 |
EXPOSE 7860
|
| 62 |
|
| 63 |
+
# Launch code-server
|
| 64 |
CMD ["code-server", "--port", "7860", "/home/coder/project"]
|