File size: 759 Bytes
65c69c9
 
5911483
65c69c9
 
 
 
 
 
5911483
65c69c9
 
 
5911483
65c69c9
 
 
5911483
65c69c9
 
5911483
65c69c9
 
5911483
65c69c9
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Use the official code-server image as the base
FROM codercom/code-server:latest

# Set environment variables
ENV PASSWORD=yugam786@
ENV CODE_SERVER_PORT=8080
ENV USERNAME=coder
ENV USER_UID=1000
ENV USER_GID=1000

# Install sudo and other necessary packages
USER root
RUN apt-get update && apt-get install -y sudo

# Create a user with sudo privileges
RUN adduser --disabled-password --gecos "" --uid $USER_UID --gid $USER_GID $USERNAME \
    && echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd

# Switch back to the non-root user
USER $USERNAME

# Expose the port where code-server will run
EXPOSE ${CODE_SERVER_PORT}

# Start code-server with the desired settings
CMD ["code-server", "--bind-addr", "0.0.0.0:8080", "--auth", "password"]