tatoy commited on
Commit
928e4ae
·
verified ·
1 Parent(s): 7af8cd3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -11
Dockerfile CHANGED
@@ -8,11 +8,13 @@ RUN apt-get update && apt-get install -y \
8
  ca-certificates \
9
  sudo
10
 
11
- # Clean up APT when done
12
  RUN apt-get clean && rm -rf /var/lib/apt/lists/*
13
 
 
 
 
14
  # Create /data directory and give permission to user 1001
15
- RUN mkdir -p /data
16
 
17
  # Download and install gotty
18
  RUN wget -O gotty.tar.gz https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz \
@@ -22,23 +24,18 @@ RUN wget -O gotty.tar.gz https://github.com/yudai/gotty/releases/download/v1.0.1
22
 
23
  # Create user 1001 and set working directory
24
  RUN useradd -u 1001 -d /data user1001 \
25
- && echo 'user1001 ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/user1001 \
26
  && chmod 0440 /etc/sudoers.d/user1001
27
 
28
- # Switch to user 1001
29
- USER user1001
30
-
31
- # Set working directory to /data
32
  WORKDIR /data
33
 
34
- # Change ownership of the /data folder
35
- RUN chown -R user1001:user1001 /data
36
-
37
  # Create .bashrc file and set PS1 environment variable
38
  RUN echo 'PS1="online-terminal:\\w\\$ "' > /data/.bashrc
39
 
40
  # Expose port
41
  EXPOSE 8080
42
 
43
- # Use gotty to run bash with the modified PS1 environment variable
44
  CMD ["gotty", "--permit-write", "--port", "3000", "--permit-arguments", "/bin/bash", "--rcfile", "/data/.bashrc"]
 
8
  ca-certificates \
9
  sudo
10
 
 
11
  RUN apt-get clean && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Disable 'no new privileges' flag
14
+ # RUN echo 'Defaults !sysctl,!snap' > /etc/sudoers.d/no-new-privileges
15
+
16
  # Create /data directory and give permission to user 1001
17
+ RUN mkdir -p /data && chown -R 1001:1001 /data
18
 
19
  # Download and install gotty
20
  RUN wget -O gotty.tar.gz https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz \
 
24
 
25
  # Create user 1001 and set working directory
26
  RUN useradd -u 1001 -d /data user1001 \
27
+ && echo 'user1001 ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/user1001 \
28
  && chmod 0440 /etc/sudoers.d/user1001
29
 
30
+ # Switch to user 1001 and set working directory
31
+ USER 1001
 
 
32
  WORKDIR /data
33
 
 
 
 
34
  # Create .bashrc file and set PS1 environment variable
35
  RUN echo 'PS1="online-terminal:\\w\\$ "' > /data/.bashrc
36
 
37
  # Expose port
38
  EXPOSE 8080
39
 
40
+ # Use gotty to run bash and modify PS1 environment variable
41
  CMD ["gotty", "--permit-write", "--port", "3000", "--permit-arguments", "/bin/bash", "--rcfile", "/data/.bashrc"]