File size: 1,606 Bytes
c76a212
9e2045b
c76a212
9e2045b
c76a212
 
9e2045b
c76a212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e2045b
c76a212
 
9e2045b
c76a212
 
9e2045b
c76a212
 
9e2045b
aa0c93f
 
 
74ef551
 
 
c76a212
74ef551
c76a212
 
 
 
bbdab3a
 
 
c76a212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
74
75
76
FROM ubuntu:focal

ENV DEBIAN_FRONTEND=noninteractive

# Update package lists and upgrade existing packages
RUN apt-get update && apt-get upgrade -y

# Install necessary packages
RUN apt-get install -y \
    curl \
    neofetch \
    ffmpeg \
    imagemagick \
    git \
    git-lfs \
    nodejs \
    npm \
    software-properties-common \
    python3 \
    python3-pip \
    python3-venv \
    build-essential \
    libvips \
    libvips-dev \
    libjpeg-dev \
    libpng-dev \
    chromium-browser \
    libgbm-dev \
    xvfb

# Install speedtest-cli using pip
RUN pip install --no-cache-dir speedtest-cli

# Install the latest version of Node.js using n
RUN npm install -g n && n latest

# Update npm to the latest version
RUN npm install -g npm@latest

# Clear npm cache
RUN npm cache clean --force

# Manually delete npm cache folder
RUN rm -rf /root/.npm

# Install Puppeteer
RUN mkdir -p /home/nex/app && cd /home/nex/app && npm init -y && npm install puppeteer

# Create a non-root user
RUN useradd -m -u 1000 nex

# Change ownership of the home directory to the non-root user
RUN chown -R nex:nex /home/nex

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

# Set up Python virtual environment
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"

# Switch to non-root user
USER nex

# Set environment variables
ENV HOME=/home/nex \
    PATH=/home/nex/.local/bin:$PATH

# Set the working directory
WORKDIR $HOME

# Copy the application code
COPY --chown=nex . $HOME/server

# Start code-server
CMD ["code-server", ".", "--bind-addr", "0.0.0.0:7860", "--auth", "none"]