File size: 1,101 Bytes
72b356f
 
f33baf3
72b356f
 
 
f33baf3
 
 
 
 
 
 
72b356f
 
f33baf3
 
 
 
 
 
b3599ec
72b356f
 
f33baf3
 
 
 
72b356f
 
f33baf3
72b356f
 
 
f33baf3
 
 
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
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 \
    # 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
COPY opencode.deb /tmp/opencode.deb
RUN dpkg -i /tmp/opencode.deb || apt-get install -f -y

# 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 ["sh", "-c", "opencode-desktop --host 0.0.0.0 --port 7860 || opencode --host 0.0.0.0 --port 7860 || /opt/OpenCode/opencode --host 0.0.0.0 --port 7860"]