Update Dockerfile
Browse files- Dockerfile +12 -24
Dockerfile
CHANGED
|
@@ -1,10 +1,8 @@
|
|
| 1 |
-
# Use official code-server base image
|
| 2 |
FROM codercom/code-server:latest
|
| 3 |
|
| 4 |
-
# Switch to root user for installing system packages
|
| 5 |
USER root
|
| 6 |
|
| 7 |
-
#
|
| 8 |
RUN apt-get update && \
|
| 9 |
apt-get install -y \
|
| 10 |
python3-pip \
|
|
@@ -28,35 +26,25 @@ RUN apt-get update && \
|
|
| 28 |
npm install -g npm yarn && \
|
| 29 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 30 |
|
| 31 |
-
# Install Python
|
| 32 |
RUN pip3 install --break-system-packages --no-cache-dir --upgrade pip setuptools wheel && \
|
| 33 |
pip3 install --break-system-packages ipython virtualenv jupyter
|
| 34 |
|
| 35 |
-
#
|
| 36 |
RUN mkdir -p /home/coder/project && chown -R coder:coder /home/coder/project
|
| 37 |
|
| 38 |
-
# Switch back to
|
| 39 |
USER coder
|
| 40 |
|
| 41 |
-
|
| 42 |
-
ENV
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
echo '{ \
|
| 49 |
-
"bind-addr": "0.0.0.0:7860", \
|
| 50 |
-
"auth": "password", \
|
| 51 |
-
"password": "'"${PASSWORD}"'", \
|
| 52 |
-
"cert": false \
|
| 53 |
-
}' > ~/.config/code-server/config.json
|
| 54 |
-
|
| 55 |
-
# Set the working directory
|
| 56 |
WORKDIR /home/coder/project
|
| 57 |
|
| 58 |
-
# Expose the port for Hugging Face Space
|
| 59 |
EXPOSE 7860
|
| 60 |
|
| 61 |
-
|
| 62 |
-
CMD ["code-server", "--port", "7860", "/home/coder/project"]
|
|
|
|
|
|
|
| 1 |
FROM codercom/code-server:latest
|
| 2 |
|
|
|
|
| 3 |
USER root
|
| 4 |
|
| 5 |
+
# Install system tools and dev environment
|
| 6 |
RUN apt-get update && \
|
| 7 |
apt-get install -y \
|
| 8 |
python3-pip \
|
|
|
|
| 26 |
npm install -g npm yarn && \
|
| 27 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 28 |
|
| 29 |
+
# Install Python libraries
|
| 30 |
RUN pip3 install --break-system-packages --no-cache-dir --upgrade pip setuptools wheel && \
|
| 31 |
pip3 install --break-system-packages ipython virtualenv jupyter
|
| 32 |
|
| 33 |
+
# Setup workspace
|
| 34 |
RUN mkdir -p /home/coder/project && chown -R coder:coder /home/coder/project
|
| 35 |
|
| 36 |
+
# Switch back to non-root user
|
| 37 |
USER coder
|
| 38 |
|
| 39 |
+
ENV PORT=7860
|
| 40 |
+
ENV HOME=/home/coder
|
| 41 |
+
|
| 42 |
+
# Delay config writing until container run using entrypoint script
|
| 43 |
+
COPY --chown=coder:coder entrypoint.sh /home/coder/entrypoint.sh
|
| 44 |
+
RUN chmod +x /home/coder/entrypoint.sh
|
| 45 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
WORKDIR /home/coder/project
|
| 47 |
|
|
|
|
| 48 |
EXPOSE 7860
|
| 49 |
|
| 50 |
+
CMD ["/home/coder/entrypoint.sh"]
|
|
|