added opencode image
All checks were successful
CI / Build opencode docker images (push) Successful in 12m59s

This commit is contained in:
2026-01-20 21:11:55 +08:00
parent 5bc3b26965
commit 7cc5ec4559
2 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
name: CI
on:
push:
branches: [ master ]
paths:
- 'cgit/*'
- '.gitea/workflows/build-opencode.yaml'
jobs:
"Build opencode docker images":
runs-on: woryzen
steps:
-
name: Login to Gitea container registry
uses: docker/login-action@v3
with:
registry: gitea.woggioni.net
username: woggioni
password: ${{ secrets.PUBLISHER_TOKEN }}
-
name: Build and push opencode images
uses: docker/build-push-action@v6
with:
builder: multiplatform-builder
context: "{{defaultContext}}:opencode"
build-args: |
OPENCODE_VERSION=1.1.26
ALPINE_VERSION=3.23
platforms: |
linux/amd64
linux/arm64
push: true
pull: true
tags: |
"gitea.woggioni.net/woggioni/opencode:1.1.26"
"gitea.woggioni.net/woggioni/opencode:1.1.26-alpine3.23"
"gitea.woggioni.net/woggioni/opencode:1.1.26-alpine"
"gitea.woggioni.net/woggioni/opencode:latest"

47
opencode/Dockerfile Normal file
View File

@@ -0,0 +1,47 @@
ARG ALPINE_VERSION=latest
FROM --platform=$BUILDPLATFORM alpine:${ALPINE_VERSION} AS base
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
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
RUN tar -xvf ./opencode.tgz -C /usr/bin
RUN rm opencode.tgz
RUN adduser -D -h /var/lib/opencode opencode
RUN mkdir /workspace
RUN chown opencode:opencode /workspace
USER opencode
WORKDIR /workspace
RUN pipx install pyright
ENTRYPOINT ["opencode"]
VOLUME ["/workspace"]
# FROM oven/bun:1.3.5-alpine AS builder
# FROM node:25-alpine AS builder
# ARG VERSION
# ENTRYPOINT sh
# RUN adduser -D -h /home/builder builder
# USER builder
# WORKDIR /home/builder
# ADD --chown=builder:builder git@github.com:anomalyco/opencode.git#v${VERSION} opencode
# WORKDIR /home/builder/opencode
# RUN bun install
# WORKDIR /home/builder/opencode/packages/opencode
# RUN OPENCODE_CHANNEL=latest OPENCODE_VERSION=1.1.25 bun run ./script/build.ts --single
#RUN rm ./opencode.tgz
# RUN adduser -D -h /var/lib/opencode opencode
# USER opencode
# WORKDIR /var/lib/opencode