Switch opencode image to build from source
CI / Build opencode docker images (push) Failing after 3m27s

This commit is contained in:
2026-07-21 20:20:39 +08:00
parent 85be151eac
commit 640548d34c
3 changed files with 242 additions and 4 deletions
+21 -3
View File
@@ -1,8 +1,26 @@
ARG BUN_VERSION
FROM oven/bun:${BUN_VERSION}-alpine AS build
ARG OPENCODE_VERSION
RUN apk update
RUN --mount=type=cache,target=/var/cache/apk apk update
RUN --mount=type=cache,target=/var/cache/apk apk add python3 make g++ npm zip git
RUN adduser -D -h /home/builder -u 1126 builder
USER builder
WORKDIR /home/builder
ADD --chown=builder:builder --keep-git-dir=true git@github.com:anomalyco/opencode.git#v${OPENCODE_VERSION} opencode
WORKDIR /home/builder/opencode
RUN --mount=type=cache,target=/home/builder/.bun/install/cache,uid=1126 bun install
ADD --chown=builder:builder ./build.ts ./packages/opencode/script/build.ts
RUN --mount=type=cache,target=/home/builder/.bun/install/cache,uid=1126 ./packages/opencode/script/build.ts
FROM archlinux:latest AS release
ARG OPENCODE_VERSION
COPY mirrorlist /etc/pacman.d/mirrolist
RUN pacman-key --init
#RUN pacman-key --refresh-keys
@@ -27,7 +45,7 @@ USER opencode
RUN pipx install pyright
RUN pipx install pip-tools
USER root
ADD https://github.com/anomalyco/opencode/releases/download/v${OPENCODE_VERSION}/opencode-linux-x64.tar.gz ./opencode.tgz
COPY --from=build --chown=root:root /home/builder/opencode/packages/opencode/dist/opencode-linux-x64/bin/opencode /usr/bin/opencode
RUN tar -xvf ./opencode.tgz -C /usr/bin
RUN rm opencode.tgz
ADD --chown=opencode:opencode ./opencode.json /etc/opencode/opencode.json