NitinBot002 commited on
Commit
73c7f3f
·
verified ·
1 Parent(s): a60a200

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -22
Dockerfile CHANGED
@@ -1,29 +1,34 @@
1
- FROM debian:bullseye-slim
 
2
 
3
- # Install dependencies
4
- RUN apt-get update && apt-get install -y \
5
- curl ca-certificates tar gzip libseccomp2 libssl1.1 git \
6
- && rm -rf /var/lib/apt/lists/*
 
7
 
8
- # Create non-root user
9
- RUN useradd -ms /bin/bash coder
10
- USER coder
11
- ENV HOME=/home/coder
12
- WORKDIR /home/coder
13
 
14
- # Create bin directory for local binaries
15
- RUN mkdir -p /home/coder/.local/bin
 
 
 
16
 
17
- # Download and extract Coder binary (no dpkg/sudo)
18
- ENV CODER_VERSION=2.23.1
19
- RUN curl -L "https://github.com/coder/coder/releases/download/v${CODER_VERSION}/coder_${CODER_VERSION}_linux_amd64.tar.gz" | tar -xz \
20
- && mv coder /home/coder/.local/bin/coder \
21
- && chmod +x /home/coder/.local/bin/coder
22
 
23
- ENV PATH="/home/coder/.local/bin:$PATH"
 
 
 
24
 
25
- # Expose Coder server port
26
- EXPOSE 3000
27
 
28
- # Run Coder server on container start
29
- CMD ["coder", "server"]
 
1
+ # Start from the official code-server image
2
+ FROM codercom/code-server:latest
3
 
4
+ # Set environment variables
5
+ ENV PASSWORD=hfspacespassword \
6
+ PORT=7860 \
7
+ HOME=/home/coder \
8
+ DOCKER_USER=coder
9
 
10
+ # Set user to root to install dependencies
11
+ USER root
12
+
13
+ # Install any dependencies if needed (optional)
14
+ RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
15
 
16
+ # Create project folder
17
+ RUN mkdir -p /home/coder/project && chown -R coder:coder /home/coder/project
18
+
19
+ # Switch back to coder user
20
+ USER coder
21
 
22
+ # Set working directory
23
+ WORKDIR /home/coder/project
 
 
 
24
 
25
+ # Change default port in config if exists
26
+ RUN mkdir -p ~/.config/code-server && \
27
+ echo '{"bind-addr": "0.0.0.0:7860", "auth": "password", "password": "'"$PASSWORD"'", "cert": false}' \
28
+ > ~/.config/code-server/config.json
29
 
30
+ # Expose the port
31
+ EXPOSE 7860
32
 
33
+ # Start code-server
34
+ CMD ["code-server", "--port", "7860", "/home/coder/project"]