diff --git a/.gitea/workflows/build-opencode.yaml b/.gitea/workflows/build-opencode.yaml index 055adba..40234ea 100644 --- a/.gitea/workflows/build-opencode.yaml +++ b/.gitea/workflows/build-opencode.yaml @@ -7,7 +7,32 @@ on: - 'opencode/*' - '.gitea/workflows/build-opencode.yaml' jobs: - "Build opencode docker images": + # "Build opencode docker images": + # runs-on: hostinger + # 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.18.4 + # platforms: | + # linux/amd64 + # push: true + # pull: true + # tags: | + # "gitea.woggioni.net/woggioni/opencode:1.18.4" + # "gitea.woggioni.net/woggioni/opencode:latest" + build-from-source: runs-on: hostinger steps: - @@ -23,13 +48,11 @@ jobs: with: builder: multiplatform-builder context: "{{defaultContext}}:opencode" + file: opencode/from_source.dockerfile build-args: | - OPENCODE_VERSION=1.18.4 + VERSION=1.18.4 platforms: | linux/amd64 - push: true + push: false pull: true - tags: | - "gitea.woggioni.net/woggioni/opencode:1.18.4" - "gitea.woggioni.net/woggioni/opencode:latest" diff --git a/opencode/from-source.dockerfile b/opencode/from-source.dockerfile new file mode 100644 index 0000000..eb9d8ce --- /dev/null +++ b/opencode/from-source.dockerfile @@ -0,0 +1,27 @@ +FROM oven/bun:1.3.14-alpine AS builder + +#FROM node:25-alpine AS builder +ARG VERSION +ENTRYPOINT sh +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 +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 --mount=type=cache,target=/home/builder/.bun/install/cache bun install +WORKDIR /home/builder/opencode/packages/opencode +ENV OPENCODE_CHANNEL=latest +ENV OPENCODE_VERSION=${VERSION} +ENV OPENCODE_RELEASE=${VERSION} +#bun run ./script/build.ts --single +RUN --mount=type=cache,target=/home/builder/.bun/install/cache ./packages/opencode/script/build.ts +RUN --mount=type=cache,target=/home/builder/.bun/install/cache ./packages/cli/script/build.ts + +RUN rm ./opencode.tgz + +RUN adduser -D -h /var/lib/opencode opencode +USER opencode +WORKDIR /var/lib/opencode