veltrixcode commited on
Commit
27b556f
·
verified ·
1 Parent(s): fd1847a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -13
Dockerfile CHANGED
@@ -1,31 +1,48 @@
 
1
  FROM ubuntu:22.04
2
 
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
 
5
  RUN apt-get update && apt-get install -y \
6
- curl ca-certificates git python3 python3-pip \
7
- build-essential wget sudo \
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
 
 
 
 
 
 
 
 
 
 
10
  RUN curl -fsSL https://code-server.dev/install.sh | sh
11
 
 
12
  RUN useradd -m -s /bin/bash coder && \
13
  echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
14
 
15
- USER coder
16
- WORKDIR /home/coder
 
 
 
 
17
 
18
- RUN mkdir -p /home/coder/projects
 
 
19
 
 
20
  USER root
21
- RUN mkdir -p /data && chown -R coder:coder /data
22
- USER coder
23
-
24
- RUN ln -s /data /home/coder/persist
25
 
 
26
  EXPOSE 7860
27
 
28
- ENV PORT=7860
29
-
30
- # No PASSWORD env; explicitly disable auth
31
- CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "/data"]
 
1
+ # Base image
2
  FROM ubuntu:22.04
3
 
4
+ # Prevent interactive prompts during build
5
  ENV DEBIAN_FRONTEND=noninteractive
6
 
7
+ # 1. Install Basics & Python
8
  RUN apt-get update && apt-get install -y \
9
+ curl ca-certificates git wget sudo \
10
+ python3 python3-pip python3-venv python-is-python3 \
11
+ build-essential \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # 2. Install Node.js (LTS version)
15
+ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
16
+ apt-get install -y nodejs
17
+
18
+ # 3. Install MySQL Server
19
+ RUN apt-get update && apt-get install -y mysql-server \
20
+ && rm -rf /var/lib/apt/lists/* \
21
+ && mkdir -p /var/run/mysqld && chown mysql:mysql /var/run/mysqld
22
+
23
+ # 4. Install code-server
24
  RUN curl -fsSL https://code-server.dev/install.sh | sh
25
 
26
+ # 5. Create 'coder' user
27
  RUN useradd -m -s /bin/bash coder && \
28
  echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
29
 
30
+ # 6. Setup Workspace & Persistence Directories
31
+ # We create /data/mysql proactively so permissions can be fixed
32
+ RUN mkdir -p /home/coder/projects \
33
+ && mkdir -p /data/mysql \
34
+ && chown -R coder:coder /home/coder \
35
+ && chown -R mysql:mysql /data/mysql
36
 
37
+ # 7. Add the startup script
38
+ COPY start.sh /usr/local/bin/start.sh
39
+ RUN chmod +x /usr/local/bin/start.sh
40
 
41
+ # Switch to root to allow start.sh to fix permissions on startup
42
  USER root
 
 
 
 
43
 
44
+ # Expose port
45
  EXPOSE 7860
46
 
47
+ # Start!
48
+ CMD ["/usr/local/bin/start.sh"]