switched opencode image to Archlinux
All checks were successful
CI / Build opencode docker images (push) Successful in 9m53s

This commit is contained in:
2026-04-01 21:30:31 +08:00
parent 635d3aac3e
commit 8b3c54f8d4
4 changed files with 44 additions and 21 deletions

View File

@@ -1,32 +1,40 @@
ARG ALPINE_VERSION=latest
FROM --platform=$BUILDPLATFORM alpine:${ALPINE_VERSION} AS base
RUN --mount=type=cache,target=/var/cache/apk apk update
RUN --mount=type=cache,target=/var/cache/apk apk add rust-analyzer openjdk25-jdk jdtls pipx ripgrep git helix helix-tree-sitter-vendor
RUN adduser -D -h /var/lib/opencode opencode
FROM archlinux:latest AS release
ARG OPENCODE_VERSION
COPY mirrorlist /etc/pacman.d/mirrolist
RUN pacman-key --init
#RUN pacman-key --refresh-keys
ADD https://gitea.woggioni.net/api/packages/woggioni/arch/repository.key ./repository.key
RUN pacman-key --add repository.key
RUN pacman-key --lsign-key 0D28BF66FDB45D18D8EBEE5D4C91DADCD00B3F77
RUN --mount=type=bind,source=pacman-gitea-repository.conf,target=pacman-gitea-repository.conf cat pacman-gitea-repository.conf >> /etc/pacman.conf
RUN echo PATH DEFAULT=${HOME}/.local/bin:/usr/local/bin:/bin >> /etc/security/pam_env.conf
RUN rm repository.key
RUN --mount=type=cache,target=/var/cache/pacman pacman -Syu --noconfirm
RUN --mount=type=cache,target=/var/cache/pacman pacman -S --noconfirm --needed \
rustup rust-analyzer jdtls python-pipx ripgrep git rustup gradle curl sccache \
helix bash-language-server marksman python-lsp-server vscode-css-languageserver \
vscode-html-languageserver vscode-json-languageserver yaml-language-server
RUN --mount=type=cache,target=/var/cache/pacman pacman -S --noconfirm --needed jdk25-graalvm-ce-bin
RUN useradd -m -d /var/lib/opencode opencode
RUN mkdir /workspace
RUN chown opencode:opencode /workspace
USER opencode
RUN pipx install pyright
USER root
ARG TARGETPLATFORM BUILDPLATFORM OPENCODE_VERSION
FROM base AS builder-linux_arm64
ADD https://github.com/anomalyco/opencode/releases/download/v${OPENCODE_VERSION}/opencode-linux-arm64-musl.tar.gz ./opencode.tgz
FROM base AS builder-linux_amd64
ADD https://github.com/anomalyco/opencode/releases/download/v${OPENCODE_VERSION}/opencode-linux-x64-musl.tar.gz ./opencode.tgz
FROM builder-${TARGETPLATFORM//\//_} AS release
ADD https://github.com/anomalyco/opencode/releases/download/v${OPENCODE_VERSION}/opencode-linux-x64.tar.gz ./opencode.tgz
RUN tar -xvf ./opencode.tgz -C /usr/bin
RUN rm opencode.tgz
ADD --chown=opencode:opencode ./opencode.json /etc/opencode/opencode.json
RUN mkdir -p /usr/lib/opencode/addons
ADD --chmod=644 https://repo1.maven.org/maven2/org/projectlombok/lombok/1.18.44/lombok-1.18.44.jar /usr/lib/opencode/addons/lombok.jar
ENV OPENCODE_CONFIG=/etc/opencode/opencode.json
ENV EDITOR=hx
ENV EDITOR=helix
USER opencode
WORKDIR /workspace
ENTRYPOINT ["opencode"]
VOLUME ["/var/lib/opencode", "/workspace"]