image_ai / Dockerfile
shashwatIDR's picture
Update Dockerfile
3d69754 verified
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"]