File size: 3,931 Bytes
3d69754
 
 
 
 
 
 
 
 
 
 
fa15271
5079579
8e31a92
302742c
1a080a1
8e31a92
5079579
 
 
 
9dafad4
 
5079579
 
 
1a080a1
 
 
 
 
 
 
 
 
3d69754
1a080a1
3d69754
1a080a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8e31a92
24c7dbc
 
 
fa15271
1a080a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9dafad4
 
 
24c7dbc
 
 
 
5079579
 
 
 
9dafad4
 
 
 
5079579
24c7dbc
fa15271
5079579
 
 
9dafad4
 
 
 
 
5079579
1a080a1
3d69754
1a080a1
 
 
 
 
 
8e31a92
 
fa15271
cb65b84
fa15271
 
1a080a1
 
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
libasound2 \
        libatk-bridge2.0-0 \
        libdrm2 \
        libxkbcommon0 \
        libxss1 \
        libxrandr2 \
        libpangocairo-1.0-0 \
        libatk1.0-0 \
        libcairo-gobject2 \
        libgtk-3-0 \
        libgdk-pixbuf2.0-0 \FROM codercom/code-server:latest

# Switch to root user for setup
USER root

# Install Python, Node.js, and comprehensive development tools
RUN apt-get update && \
    apt-get install -y \
        python3 \
        python3-pip \
        python3-venv \
        python3-full \
        pipx \
        curl \
        git \
        build-essential \
        wget \
        unzip \
        vim \
        nano \
        htop \
        tree \
        jq \
        sqlite3 \
        postgresql-client \
        default-mysql-client \
        redis-tools \
        chromium \
        xvfb \
        fonts-liberation \
        libasound2 \
        libatk-bridge2.0-0 \
        libdrm2 \
        libxkbcommon0 \
        libxss1 \
        libgconf-2-4 \
        libxrandr2 \
        libasound2 \
        libpangocairo-1.0-0 \
        libatk1.0-0 \
        libcairo-gobject2 \
        libgtk-3-0 \
        libgdk-pixbuf2.0-0 \
        ffmpeg \
        imagemagick \
        pandoc \
        texlive-xetex \
        texlive-fonts-recommended \
        texlive-plain-generic && \
    curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
    apt-get install -y nodejs && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Install common Python packages globally to avoid runtime issues
RUN pip3 install --break-system-packages \
    flask \
    fastapi \
    uvicorn \
    requests \
    beautifulsoup4 \
    selenium \
    pandas \
    numpy \
    matplotlib \
    seaborn \
    plotly \
    jupyter \
    notebook \
    streamlit \
    gradio \
    opencv-python-headless \
    pillow \
    scikit-learn \
    tensorflow \
    torch \
    transformers \
    openai \
    anthropic \
    langchain \
    chromadb \
    sqlalchemy \
    psycopg2-binary \
    pymongo \
    redis \
    celery \
    pytest \
    black \
    flake8 \
    mypy

# Install global npm packages commonly used
RUN npm install -g \
    create-react-app \
    vue-cli \
    @angular/cli \
    express-generator \
    pm2 \
    nodemon \
    typescript \
    ts-node \
    webpack \
    vite \
    eslint \
    prettier \
    jest \
    mocha \
    cypress \
    playwright \
    @playwright/test

# Remove the externally-managed-environment file to allow pip installs
RUN rm -f /usr/lib/python*/EXTERNALLY-MANAGED

# Create the working directory and set proper ownership
RUN mkdir -p /animesh && \
    chown -R coder:coder /animesh

# Set up npm global directory for coder user to avoid permission issues
RUN mkdir -p /home/coder/.npm-global && \
    chown -R coder:coder /home/coder/.npm-global

# Create a Python virtual environment that's always activated
RUN python3 -m venv /home/coder/.venv && \
    chown -R coder:coder /home/coder/.venv

# Switch back to coder user
USER coder

# Configure npm to use user-owned global directory
RUN npm config set prefix '/home/coder/.npm-global'

# Update PATH to include npm global binaries, venv, and local binaries
ENV PATH="/home/coder/.venv/bin:/home/coder/.npm-global/bin:/home/coder/.local/bin:$PATH"

# Upgrade pip in the virtual environment
RUN /home/coder/.venv/bin/pip install --upgrade pip

# Set up Chromium for headless browsing (for Selenium/Playwright)
ENV CHROME_BIN=/usr/bin/chromium
ENV DISPLAY=:99

# Create a script to start Xvfb in the background
RUN echo '#!/bin/bash\nXvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &' > /home/coder/start-xvfb.sh && \
    chmod +x /home/coder/start-xvfb.sh

# Set the working directory
WORKDIR /animesh

# Expose port for Hugging Face Spaces
EXPOSE 7860

# Start Xvfb and then code-server
CMD ["/bin/bash", "-c", "/home/coder/start-xvfb.sh && code-server --auth=none --bind-addr 0.0.0.0:7860 /animesh"]