| 1 | # The Cloudflare-container twin of `../microvm-opencode/Dockerfile`: the same |
| 2 | # opencode server started eagerly as the entrypoint. Cloudflare containers boot |
| 3 | # the image from scratch on each cold start (no memory snapshot), so this |
| 4 | # variant pays opencode's process startup inside every boot — the comparison |
| 5 | # the MicroVM snapshot variant is designed to isolate. |
| 6 | # |
| 7 | # Cloudflare builds containers for linux/amd64 and the AWS MicroVM base image |
| 8 | # is ARM64-only, so use plain Amazon Linux 2023 (same OS family, multi-arch). |
| 9 | # The base OS barely matters — opencode ships its own runtime. |
| 10 | FROM amazonlinux:2023 |
| 11 | |
| 12 | RUN dnf install -y unzip tar gzip git && dnf clean all |
| 13 | RUN curl -fsSL https://opencode.ai/install | bash \ |
| 14 | && ln -s /root/.opencode/bin/opencode /usr/local/bin/opencode |
| 15 | |
| 16 | WORKDIR /workspace |
| 17 | |
| 18 | ENV OPENCODE_SERVER_PASSWORD=bench |
| 19 | |
| 20 | EXPOSE 8080 |
| 21 | ENTRYPOINT ["opencode", "serve", "--hostname", "0.0.0.0", "--port", "8080"] |