Skip to content

Commit 590b113

Browse files
authored
Refactor Dockerfile to use custom base image and Alpine
1 parent 7be31e5 commit 590b113

1 file changed

Lines changed: 5 additions & 30 deletions

File tree

opencode/Dockerfile

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,20 @@ COPY opencode/ ./opencode/
1414
RUN CGO_ENABLED=0 GOOS=linux go build -o opencode-mcp-server ./opencode/
1515

1616
# Final stage - use Debian instead of Alpine for glibc compatibility
17-
FROM debian:bookworm-slim
17+
FROM ghcr.io/anomalyco/opencode
1818

1919
# Install required runtime dependencies
20-
RUN apt-get update && apt-get install -y --no-install-recommends \
21-
ca-certificates \
22-
curl \
23-
bash \
24-
wget \
25-
git \
26-
&& rm -rf /var/lib/apt/lists/*
27-
28-
RUN curl -fsSL https://opencode.ai/install | bash
29-
30-
RUN ln -s /root/.opencode/bin/opencode /usr/bin/opencode
20+
RUN apk add git curl bash
3121

3222
# Install GitHub CLI
33-
RUN (type -p wget >/dev/null || (apt-get update && apt-get install wget -y)) \
34-
&& mkdir -p -m 755 /etc/apt/keyrings \
35-
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
36-
&& cat $out | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
37-
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
38-
&& mkdir -p -m 755 /etc/apt/sources.list.d \
39-
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
40-
&& apt-get update \
41-
&& apt-get install gh -y \
42-
&& rm -rf /var/lib/apt/lists/*
23+
RUN echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && apk add github-cli@community
4324

4425
# Copy the MCP server binary
4526
COPY --from=builder /app/opencode-mcp-server /usr/local/bin/opencode-mcp-server
4627

47-
# Verify opencode binary is properly installed
48-
RUN which opencode && opencode --version || echo "Warning: opencode may not be properly installed"
49-
50-
# Create session directory
51-
RUN mkdir -p /tmp/opencode-sessions
52-
5328
# Set environment variables
54-
ENV OPENCODE_SESSION_DIR=/tmp/opencode-sessions
55-
ENV OPENCODE_BINARY=/usr/bin/opencode
29+
ENV OPENCODE_SESSION_DIR=/root
30+
ENV OPENCODE_BINARY=/usr/local/bin/opencode
5631
ENV OPENCODE_MAX_SESSIONS=10
5732
ENV OPENCODE_LOG_RETENTION_HOURS=24
5833
ENV OPENCODE_FORMAT=json

0 commit comments

Comments
 (0)