| FROM ubuntu:22.04 |
|
|
| |
| ENV DEBIAN_FRONTEND=noninteractive |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| curl \ |
| wget \ |
| git \ |
| nginx \ |
| python3 \ |
| python3-pip \ |
| nodejs \ |
| npm \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN curl -fsSL https://code-server.dev/install.sh | sh |
|
|
| |
| RUN wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb \ |
| && dpkg -i cloudflared-linux-amd64.deb \ |
| && rm cloudflared-linux-amd64.deb |
|
|
| |
| RUN useradd -m -u 1000 user |
| USER user |
| WORKDIR /home/user |
|
|
| |
| RUN mkdir -p /home/user/.config/code-server/ \ |
| && echo -e "bind-addr: 0.0.0.0:7860\nauth: password\ncert: false" > /home/user/.config/code-server/config.yaml |
|
|
| |
| USER root |
|
|
| |
| RUN mkdir -p /var/www/html |
| RUN echo '<html><head><title>VSCode Server</title></head><body><h1>Welcome</h1><p>VSCode Server is running!</p></body></html>' > /var/www/html/index.html |
|
|
| RUN echo 'pid /home/user/nginx.pid;\ |
| error_log /home/user/nginx_error.log;\ |
| \ |
| events {\ |
| worker_connections 1024;\ |
| }\ |
| \ |
| http {\ |
| include /etc/nginx/mime.types;\ |
| default_type application/octet-stream;\ |
| \ |
| access_log /home/user/nginx_access.log;\ |
| \ |
| server {\ |
| listen 8080;\ |
| server_name _;\ |
| root /var/www/html;\ |
| index index.html;\ |
| \ |
| location / {\ |
| try_files $uri $uri/ =404;\ |
| }\ |
| \ |
| location /admin-vscode {\ |
| proxy_pass http://127.0.0.1:7860;\ |
| proxy_set_header Host $host;\ |
| proxy_set_header X-Real-IP $remote_addr;\ |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\ |
| proxy_set_header X-Forwarded-Proto $scheme;\ |
| }\ |
| }\ |
| }' > /etc/nginx/nginx.conf |
|
|
| |
| RUN chown -R user:user /var/www/html /home/user |
| RUN chmod -R 755 /var/www/html |
|
|
| |
| COPY start-services-minimal.sh /usr/bin/start-services.sh |
| RUN chmod +x /usr/bin/start-services.sh |
|
|
| |
| USER user |
|
|
| |
| ENV HOME=/home/user \ |
| PATH=/home/user/.local/bin:$PATH |
|
|
| EXPOSE 7860 |
| EXPOSE 8080 |
|
|
| CMD ["/usr/bin/start-services.sh"] |