Spaces:
Paused
Paused
Download Dockerfile from piyaka/VSCode-IDE: direct link, hf CLI and curl.
- Browser
- Download file 3.25 kB
-
https://huggingface.co/spaces/piyaka/VSCode-IDE/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/piyaka/VSCode-IDE/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/piyaka/VSCode-IDE/resolve/main/Dockerfile
3.25 kB
| FROM ubuntu:22.04 | |
| # 1. Environment Variables | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV PUB_CACHE=/home/user/.pub-cache | |
| ENV ANDROID_SDK_ROOT=/opt/android-sdk | |
| # Browser environment variables | |
| ENV CHROME_BIN=/usr/bin/chromium-browser | |
| ENV CHROMIUM_FLAGS="--no-sandbox --disable-dev-shm-usage --disable-gpu --headless" | |
| ENV DISPLAY=:99 | |
| # Merged PATH for Flutter, Dart, and Android Tools | |
| ENV PATH="/opt/flutter/bin:/opt/flutter/bin/cache/dart-sdk/bin:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${ANDROID_SDK_ROOT}/platform-tools:${PATH}" | |
| # 2. Install System Dependencies + Chromium + Virtual Display | |
| RUN apt-get update && apt-get install -y \ | |
| curl git unzip xz-utils zip libglu1-mesa python3 python3-pip wget openjdk-17-jdk \ | |
| # Chromium browser | |
| chromium-browser \ | |
| # Virtual display (needed for non-headless fallback) | |
| xvfb \ | |
| # Chromium runtime dependencies | |
| libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 \ | |
| libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 \ | |
| libxrandr2 libgbm1 libasound2 libpango-1.0-0 libpangocairo-1.0-0 \ | |
| libgtk-3-0 libx11-xcb1 \ | |
| # Python headless browser tools | |
| && pip3 install --no-cache-dir \ | |
| selenium \ | |
| playwright \ | |
| pyppeteer \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 3. Install Playwright browsers (Chromium via Playwright) | |
| RUN python3 -m playwright install chromium \ | |
| && python3 -m playwright install-deps chromium | |
| # 4. Install code-server | |
| RUN curl -fsSL https://code-server.dev/install.sh | sh | |
| # 5. Install Flutter SDK | |
| RUN git clone https://github.com/flutter/flutter.git /opt/flutter | |
| # 6. Install Android SDK Command Line Tools | |
| RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools && \ | |
| wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O /tmp/tools.zip && \ | |
| unzip /tmp/tools.zip -d ${ANDROID_SDK_ROOT}/cmdline-tools && \ | |
| mv ${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest && \ | |
| rm /tmp/tools.zip | |
| # 7. Setup User and Permissions | |
| RUN useradd -m -u 1000 user && \ | |
| chown -R user:user /opt/flutter && \ | |
| chown -R user:user ${ANDROID_SDK_ROOT} | |
| USER user | |
| WORKDIR /home/user | |
| # 8. Configure Android SDK & Licenses | |
| RUN yes | sdkmanager --licenses && \ | |
| sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0" | |
| # 9. Activate Flutter and Extensions | |
| RUN flutter config --android-sdk ${ANDROID_SDK_ROOT} && \ | |
| flutter precache && \ | |
| flutter doctor && \ | |
| code-server --install-extension dart-code.flutter && \ | |
| code-server --install-extension dart-code.dart-code | |
| # 10. Optional: Pre-configure VS Code Settings | |
| RUN mkdir -p /home/user/.local/share/code-server/User && \ | |
| echo '{ \ | |
| "dart.flutterSdkPath": "/opt/flutter", \ | |
| "dart.sdkPath": "/opt/flutter/bin/cache/dart-sdk", \ | |
| "python.defaultInterpreterPath": "/usr/bin/python3" \ | |
| }' > /home/user/.local/share/code-server/User/settings.json | |
| # 11. Final Setup | |
| COPY --chown=user requirements.txt . | |
| RUN pip3 install --no-cache-dir -r requirements.txt || echo "No requirements.txt found, skipping..." | |
| EXPOSE 7860 | |
| # Start Xvfb virtual display + code-server | |
| CMD Xvfb :99 -screen 0 1280x720x24 -ac & \ | |
| code-server --bind-addr 0.0.0.0:7860 --auth none . |