File size: 2,066 Bytes
cc37bdf
 
 
 
 
 
cb8a063
cc37bdf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cb8a063
 
 
 
cc37bdf
 
cb8a063
 
 
cc37bdf
ceb225e
 
 
 
 
 
cc37bdf
 
cb8a063
cc37bdf
 
 
 
 
 
cb8a063
 
 
cc37bdf
 
 
cb8a063
 
cc37bdf
 
 
 
cb8a063
 
 
cc37bdf
cb8a063
cc37bdf
cb8a063
 
cc37bdf
 
 
 
 
cb8a063
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Use Python 3.9 as the base image
FROM python:3.9

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive

# Install system packages
RUN apt-get update && \
    apt-get install -y \
    curl \
    sudo \
    build-essential \
    default-jdk \
    default-jre \
    g++ \
    gcc \
    libzbar0 \
    fish \
    ffmpeg \
    nmap \
    ca-certificates \
    zsh \
    rclone \
    nginx \
    wget && \
    rm -rf /var/lib/apt/lists/*

# Install Node.js (LTS version)
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
    apt-get install -y nodejs && \
    npm install -g pnpm@8.3.1 pm2 ts-node

# Install dufs
RUN DUF_VER=$(curl -sL https://api.github.com/repos/sigoden/dufs/releases/latest | grep tag_name | cut -d'"' -f4) && \
    wget -qO /tmp/dufs.tar.gz "https://github.com/sigoden/dufs/releases/download/${DUF_VER}/dufs-${DUF_VER}-x86_64-unknown-linux-musl.tar.gz" && \
    tar xzf /tmp/dufs.tar.gz -C /usr/local/bin/ dufs && \
    chmod +x /usr/local/bin/dufs && \
    rm -f /tmp/dufs.tar.gz

# Install code-server
RUN curl -fsSL https://code-server.dev/install.sh | sh -

# Create a user to run code-server
RUN useradd -m -s /bin/zsh coder && \
    echo 'coder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

# Create code-server configuration directory
RUN mkdir -p /home/coder/.local/share/code-server/User && \
    chmod -R 777 /home/coder && \
    echo '{ \
   "workbench.colorTheme": "Default Dark Modern", \
    "telemetry.enableTelemetry": true, \
    "telemetry.enableCrashReporter": true \
}' > /home/coder/.local/share/code-server/User/settings.json && \
    chown -R coder:coder /home/coder/.local/share/code-server

# Install Python extension for code-server
RUN sudo -u coder code-server --install-extension ms-python.python

# Copy config files
COPY --chown=coder:coder start_server.sh /home/coder/
COPY nginx.conf /etc/nginx/nginx.conf

RUN chmod +x /home/coder/start_server.sh

ENV HOME=/home/coder \
    PATH=/home/coder/.local/bin:$PATH

WORKDIR /home/coder

EXPOSE 7860

CMD ["sh", "-c", "/home/coder/start_server.sh"]