Nexchan commited on
Commit
4467544
1 Parent(s): 77c5866

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -5
Dockerfile CHANGED
@@ -6,14 +6,20 @@ ENV DEBIAN_FRONTEND=noninteractive
6
  # Set environment variables
7
  ENV PYTHONUNBUFFERED 1
8
 
9
- # Expose the port that the server will run on
10
- EXPOSE 7860
11
 
12
  # Update the package list dan upgrade existing packages
13
  RUN apt update && apt upgrade -y
14
 
15
  # Install required packages
16
- RUN apt install -y curl
 
 
 
 
 
 
17
 
18
  # Add NodeSource APT repository for Node 18.x
19
  RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
@@ -38,6 +44,7 @@ RUN apt install -y imagemagick
38
 
39
  # Create a non-root user named Nex and switch to it
40
  RUN useradd -m -u 1000 Nex
 
41
  USER Nex
42
 
43
  # Set environment variables for the user
@@ -54,5 +61,5 @@ RUN npm install
54
  # Copy the rest of the application code
55
  COPY --chown=Nex . .
56
 
57
- # Start the application
58
- CMD ["code-server", ".", "--bind-addr", "0.0.0.0:7860", "--auth", "none"]
 
6
  # Set environment variables
7
  ENV PYTHONUNBUFFERED 1
8
 
9
+ # Expose the ports that the server will run on
10
+ EXPOSE 7860 22
11
 
12
  # Update the package list dan upgrade existing packages
13
  RUN apt update && apt upgrade -y
14
 
15
  # Install required packages
16
+ RUN apt install -y curl openssh-server
17
+
18
+ # Configure SSH server
19
+ RUN mkdir /var/run/sshd
20
+ RUN echo 'Nex:password' | chpasswd
21
+ RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
22
+ RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
23
 
24
  # Add NodeSource APT repository for Node 18.x
25
  RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
 
44
 
45
  # Create a non-root user named Nex and switch to it
46
  RUN useradd -m -u 1000 Nex
47
+ RUN mkdir /home/Nex/.ssh && chown Nex:Nex /home/Nex/.ssh
48
  USER Nex
49
 
50
  # Set environment variables for the user
 
61
  # Copy the rest of the application code
62
  COPY --chown=Nex . .
63
 
64
+ # Start SSH server and code-server
65
+ CMD ["sh", "-c", "service ssh start && code-server . --bind-addr 0.0.0.0:7860 --auth none"]