diff --git a/.gitea/workflows/build-opencode.yaml b/.gitea/workflows/build-opencode.yaml index 28d2512..c6c4e22 100644 --- a/.gitea/workflows/build-opencode.yaml +++ b/.gitea/workflows/build-opencode.yaml @@ -25,15 +25,11 @@ jobs: context: "{{defaultContext}}:opencode" build-args: | OPENCODE_VERSION=1.3.13 - ALPINE_VERSION=3.23 platforms: | linux/amd64 - linux/arm64 push: true pull: true tags: | "gitea.woggioni.net/woggioni/opencode:1.3.13" - "gitea.woggioni.net/woggioni/opencode:1.3.13-alpine3.23" - "gitea.woggioni.net/woggioni/opencode:1.3.13-alpine" "gitea.woggioni.net/woggioni/opencode:latest" diff --git a/opencode/Dockerfile b/opencode/Dockerfile index b2ad605..6d589dd 100644 --- a/opencode/Dockerfile +++ b/opencode/Dockerfile @@ -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"] - diff --git a/opencode/mirrorlist b/opencode/mirrorlist new file mode 100644 index 0000000..a2cfe4d --- /dev/null +++ b/opencode/mirrorlist @@ -0,0 +1,15 @@ +################################################################################ +################# Arch Linux mirrorlist generated by Reflector ################# +################################################################################ + +# With: reflector @/etc/xdg/reflector/reflector.conf +# When: 2024-07-09 04:16:31 UTC +# From: https://archlinux.org/mirrors/status/json/ +# Retrieved: 2024-07-09 04:16:31 UTC +# Last Check: 2024-07-09 03:46:09 UTC + +Server = https://archlinux.thaller.ws/$repo/os/$arch +Server = https://mirror.ubrco.de/archlinux/$repo/os/$arch +Server = https://mirror.qctronics.com/archlinux/$repo/os/$arch +Server = https://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch +Server = https://arch.phinau.de/$repo/os/$arch diff --git a/opencode/pacman-gitea-repository.conf b/opencode/pacman-gitea-repository.conf new file mode 100644 index 0000000..b1f7379 --- /dev/null +++ b/opencode/pacman-gitea-repository.conf @@ -0,0 +1,4 @@ + +[woggioni.gitea.woggioni.net] +SigLevel = Required +Server = https://gitea.woggioni.net/api/packages/woggioni/arch/default/x86_64