-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.opencode-web
More file actions
41 lines (32 loc) · 1.33 KB
/
Copy pathDockerfile.opencode-web
File metadata and controls
41 lines (32 loc) · 1.33 KB
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
39
40
41
# Dockerfile.opencode-web
# Build OpenCode WEB server optimized for web interface
# Source: https://github.com/anomalyco/opencode
# syntax=docker/dockerfile:1.7
ARG NODE_IMAGE=node:20-bookworm-slim
ARG OPENCODE_VERSION=latest
FROM ${NODE_IMAGE}
RUN apt-get update && apt-get install -y --no-install-recommends curl dumb-init ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Create opencode user
RUN adduser --gecos '' --disabled-password opencode \
&& mkdir -p /etc/sudoers.d \
&& echo "opencode ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/nopasswd \
&& chmod 0440 /etc/sudoers.d/nopasswd \
&& mkdir -p /var/log/opencode-web \
&& chown opencode:opencode /var/log/opencode-web
# Install opencode-ai
RUN npm install -g "opencode-ai@${OPENCODE_VERSION}"
# Install fixuid for PUID/PGID support
RUN ARCH="$(dpkg --print-architecture)" \
&& curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-$ARCH.tar.gz" \
| tar -C /usr/local/bin -xzf - \
&& chown root:root /usr/local/bin/fixuid \
&& chmod 4755 /usr/local/bin/fixuid \
&& mkdir -p /etc/fixuid \
&& printf "user: opencode\ngroup: opencode\n" > /etc/fixuid/config.yml
COPY scripts/opencode-web.sh /scripts/
RUN chmod +x /scripts/*.sh
EXPOSE 4001
USER opencode
WORKDIR /home/opencode
ENTRYPOINT ["/scripts/opencode-web.sh"]