| FROM ubuntu:22.04 | |
| # 1. Install system dependencies (Desktop apps need these to even start) | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| sudo \ | |
| libgbm1 \ | |
| libasound2 \ | |
| nodejs-lts \ | |
| # Standard Electron/IDE dependencies | |
| libnss3 \ | |
| libxss1 \ | |
| libatk-bridge2.0-0 \ | |
| libgtk-3-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 2. Setup user | |
| RUN useradd -m -u 1000 user | |
| USER root | |
| # 3. Copy and Install the .deb | |
| # Replace 'your_file_name.deb' with the actual name of your file | |
| RUN npm i -g opencode-ai | |
| # 4. Fix Permissions | |
| RUN chown -R user:user /home/user | |
| # 5. Switch to user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH | |
| WORKDIR $HOME/app | |
| # 6. THE FIX: We use a shell script to find the executable if 'opencode' isn't right | |
| # Most .deb IDEs install to /usr/bin/ or /opt/OpenCode/ | |
| CMD ["opencode serve --port 7860 --hostname 0.0.0.0"] | |