backto original
Browse files- Dockerfile +8 -24
Dockerfile
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
# ================================================
|
| 2 |
# Minimal VSCode (code-server) Setup for MERN Stack Development
|
| 3 |
-
# with Persistent Session Support for Hugging Face Spaces
|
| 4 |
# ================================================
|
| 5 |
FROM ubuntu:22.04
|
| 6 |
|
|
@@ -35,40 +34,25 @@ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
|
| 35 |
RUN curl -fsSL https://code-server.dev/install.sh | sh
|
| 36 |
|
| 37 |
# -------------------------------
|
| 38 |
-
# Setup
|
| 39 |
# -------------------------------
|
| 40 |
-
RUN mkdir -p /
|
| 41 |
-
&& chown -R coder:coder /
|
| 42 |
|
| 43 |
# -------------------------------
|
| 44 |
-
# Configure code-server
|
| 45 |
# -------------------------------
|
| 46 |
USER coder
|
| 47 |
-
WORKDIR /
|
| 48 |
|
| 49 |
# Default password (can be overridden by Hugging Face secret or -e PASSWORD)
|
| 50 |
ENV PASSWORD=mernpassword
|
| 51 |
|
| 52 |
-
#
|
| 53 |
-
RUN echo "bind-addr: 0.0.0.0:7860\nauth: password\npassword: ${PASSWORD}\ncert: false" > /
|
| 54 |
-
|
| 55 |
-
# -------------------------------
|
| 56 |
-
# Environment setup for persistence
|
| 57 |
-
# -------------------------------
|
| 58 |
-
ENV HOME=/data
|
| 59 |
-
ENV CODE_SERVER_USER_HOME=/data
|
| 60 |
-
ENV PATH=/data/.npm-global/bin:$PATH
|
| 61 |
-
|
| 62 |
-
# -------------------------------
|
| 63 |
-
# Make /home/coder/workspace point to persistent /data/workspace
|
| 64 |
-
# -------------------------------
|
| 65 |
-
USER root
|
| 66 |
-
RUN rm -rf /home/coder/workspace && ln -s /data/workspace /home/coder/workspace \
|
| 67 |
-
&& chown -h coder:coder /home/coder/workspace
|
| 68 |
|
| 69 |
# -------------------------------
|
| 70 |
# Expose port and start code-server
|
| 71 |
# -------------------------------
|
| 72 |
-
USER coder
|
| 73 |
EXPOSE 7860
|
| 74 |
-
CMD ["bash", "-c", "
|
|
|
|
| 1 |
# ================================================
|
| 2 |
# Minimal VSCode (code-server) Setup for MERN Stack Development
|
|
|
|
| 3 |
# ================================================
|
| 4 |
FROM ubuntu:22.04
|
| 5 |
|
|
|
|
| 34 |
RUN curl -fsSL https://code-server.dev/install.sh | sh
|
| 35 |
|
| 36 |
# -------------------------------
|
| 37 |
+
# Setup workspace directories
|
| 38 |
# -------------------------------
|
| 39 |
+
RUN mkdir -p /home/coder/workspace /home/coder/.config/code-server /home/coder/.local/share/code-server \
|
| 40 |
+
&& chown -R coder:coder /home/coder
|
| 41 |
|
| 42 |
# -------------------------------
|
| 43 |
+
# Configure code-server authentication
|
| 44 |
# -------------------------------
|
| 45 |
USER coder
|
| 46 |
+
WORKDIR /home/coder/workspace
|
| 47 |
|
| 48 |
# Default password (can be overridden by Hugging Face secret or -e PASSWORD)
|
| 49 |
ENV PASSWORD=mernpassword
|
| 50 |
|
| 51 |
+
# Write the config file so code-server knows to use password auth
|
| 52 |
+
RUN echo "bind-addr: 0.0.0.0:7860\nauth: password\npassword: ${PASSWORD}\ncert: false" > /home/coder/.config/code-server/config.yaml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# -------------------------------
|
| 55 |
# Expose port and start code-server
|
| 56 |
# -------------------------------
|
|
|
|
| 57 |
EXPOSE 7860
|
| 58 |
+
CMD ["bash", "-c", "PASSWORD=${PASSWORD} code-server --config /home/coder/.config/code-server/config.yaml --user-data-dir /home/coder/.local/share/code-server"]
|