Create Dockerfile
Browse files- Dockerfile +56 -0
Dockerfile
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ================================================
|
| 2 |
+
# Minimal VSCode (code-server) Setup for MERN Stack Development
|
| 3 |
+
# ================================================
|
| 4 |
+
FROM ubuntu:22.04
|
| 5 |
+
|
| 6 |
+
# Non-interactive apt
|
| 7 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 8 |
+
|
| 9 |
+
# Create a non-root user
|
| 10 |
+
RUN apt-get update && apt-get install -y sudo \
|
| 11 |
+
&& useradd -m -s /bin/bash coder \
|
| 12 |
+
&& echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
| 13 |
+
|
| 14 |
+
USER root
|
| 15 |
+
WORKDIR /home/coder
|
| 16 |
+
|
| 17 |
+
# -------------------------------
|
| 18 |
+
# Basic Development Tools
|
| 19 |
+
# -------------------------------
|
| 20 |
+
RUN apt-get update && apt-get install -y \
|
| 21 |
+
curl wget git unzip zip build-essential gnupg ca-certificates \
|
| 22 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 23 |
+
|
| 24 |
+
# -------------------------------
|
| 25 |
+
# Install Node.js (v22 LTS) + npm + yarn + pnpm
|
| 26 |
+
# -------------------------------
|
| 27 |
+
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
| 28 |
+
&& apt-get install -y nodejs \
|
| 29 |
+
&& npm install -g yarn pnpm
|
| 30 |
+
|
| 31 |
+
# -------------------------------
|
| 32 |
+
# Install code-server (VS Code in browser)
|
| 33 |
+
# -------------------------------
|
| 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 /home/coder/.local/share/code-server \
|
| 40 |
+
&& chown -R coder:coder /home/coder
|
| 41 |
+
|
| 42 |
+
USER coder
|
| 43 |
+
WORKDIR /home/coder/workspace
|
| 44 |
+
|
| 45 |
+
# -------------------------------
|
| 46 |
+
# Set VSCode password (secure login)
|
| 47 |
+
# You can override it at runtime via -e PASSWORD=yourpass
|
| 48 |
+
# -------------------------------
|
| 49 |
+
ENV PASSWORD=mernpassword
|
| 50 |
+
|
| 51 |
+
# -------------------------------
|
| 52 |
+
# Expose port and start code-server
|
| 53 |
+
# -------------------------------
|
| 54 |
+
EXPOSE 7860
|
| 55 |
+
CMD ["bash", "-c", "code-server --bind-addr 0.0.0.0:7860 --auth password --password ${PASSWORD} --user-data-dir /home/coder/.local/share/code-server"]
|
| 56 |
+
|