| 1 | # opencode (a real coding-agent server, ~100MB binary on a Bun runtime) started |
| 2 | # EAGERLY as the entrypoint. The MicroVM image build runs this entrypoint, |
| 3 | # waits for it to initialize, and snapshots the running memory+disk — so every |
| 4 | # `RunMicrovm` resumes with the opencode server already listening instead of |
| 5 | # paying its process startup on each boot. |
| 6 | FROM public.ecr.aws/lambda/microvms:al2023-minimal |
| 7 | |
| 8 | RUN dnf install -y unzip tar gzip git && dnf clean all |
| 9 | RUN curl -fsSL https://opencode.ai/install | bash \ |
| 10 | && ln -s /root/.opencode/bin/opencode /usr/local/bin/opencode |
| 11 | |
| 12 | WORKDIR /workspace |
| 13 | |
| 14 | # The server binds 0.0.0.0, so require basic auth (username defaults to |
| 15 | # `opencode`). The benchmark's readiness probe presents these credentials. |
| 16 | ENV OPENCODE_SERVER_PASSWORD=bench |
| 17 | |
| 18 | EXPOSE 8080 |
| 19 | ENTRYPOINT ["opencode", "serve", "--hostname", "0.0.0.0", "--port", "8080"] |