Create GitHub releases for pre-built OpenCode CLI and update Dockerfile
This commit is contained in:
23
.github/workflows/build-opencode-cli-docker.yml
vendored
23
.github/workflows/build-opencode-cli-docker.yml
vendored
@@ -11,7 +11,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: write
|
||||||
actions: read
|
actions: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -42,6 +42,27 @@ jobs:
|
|||||||
path: opencode/packages/opencode/dist/opencode-linux-x64
|
path: opencode/packages/opencode/dist/opencode-linux-x64
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: opencode-cli-${{ github.sha }}
|
||||||
|
release_name: OpenCode CLI ${{ github.sha }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
|
||||||
|
- name: Upload Release Asset
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: opencode/packages/opencode/dist/opencode-linux-x64/bin/opencode
|
||||||
|
asset_name: opencode-linux-x64
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
|
||||||
- name: Cleanup old CLI artifacts
|
- name: Cleanup old CLI artifacts
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
|
|||||||
91
Dockerfile
91
Dockerfile
@@ -1,64 +1,5 @@
|
|||||||
# Web-based PowerShell + SST OpenCode terminal
|
# Web-based PowerShell + SST OpenCode terminal
|
||||||
# x86_64 architecture support only
|
# Uses pre-built OpenCode CLI from GitHub releases
|
||||||
FROM ubuntu:24.04 AS builder
|
|
||||||
|
|
||||||
ARG PWSH_VERSION=7.4.6
|
|
||||||
ARG NODE_VERSION=20.18.1
|
|
||||||
ARG TTYD_VERSION=1.7.7
|
|
||||||
ARG BUN_VERSION=1.3.8
|
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive \
|
|
||||||
TERM=xterm-256color \
|
|
||||||
LANG=C.UTF-8 \
|
|
||||||
LC_ALL=C.UTF-8 \
|
|
||||||
BUN_INSTALL=/opt/bun \
|
|
||||||
PATH=/opt/bun/bin:$PATH
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
ca-certificates \
|
|
||||||
curl \
|
|
||||||
wget \
|
|
||||||
git \
|
|
||||||
tar \
|
|
||||||
xz-utils \
|
|
||||||
gzip \
|
|
||||||
unzip \
|
|
||||||
libicu-dev \
|
|
||||||
libssl-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN curl -fsSL -o /tmp/node.tar.xz \
|
|
||||||
"https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" \
|
|
||||||
&& tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 \
|
|
||||||
&& ln -sf /usr/local/bin/node /usr/bin/node \
|
|
||||||
&& ln -sf /usr/local/bin/npm /usr/bin/npm \
|
|
||||||
&& rm -f /tmp/node.tar.xz
|
|
||||||
|
|
||||||
RUN npm install -g bun@${BUN_VERSION} && bun --version
|
|
||||||
|
|
||||||
RUN curl -fsSL -o /tmp/powershell.tar.gz \
|
|
||||||
"https://github.com/PowerShell/PowerShell/releases/download/v${PWSH_VERSION}/powershell-${PWSH_VERSION}-linux-x64.tar.gz" \
|
|
||||||
&& mkdir -p /opt/microsoft/powershell/7 \
|
|
||||||
&& tar -xzf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7 \
|
|
||||||
&& chmod +x /opt/microsoft/powershell/7/pwsh \
|
|
||||||
&& ln -sf /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh \
|
|
||||||
&& rm -f /tmp/powershell.tar.gz
|
|
||||||
|
|
||||||
RUN curl -fsSL -o /usr/local/bin/ttyd \
|
|
||||||
"https://github.com/tsl0922/ttyd/releases/download/${TTYD_VERSION}/ttyd.x86_64" \
|
|
||||||
&& chmod +x /usr/local/bin/ttyd
|
|
||||||
|
|
||||||
COPY opencode /opt/opencode-src
|
|
||||||
|
|
||||||
WORKDIR /opt/opencode-src
|
|
||||||
|
|
||||||
# Configure git for any workspace dependencies that use git URLs
|
|
||||||
RUN git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"
|
|
||||||
|
|
||||||
RUN bun install 2>&1 \
|
|
||||||
&& bun run ./packages/opencode/script/build.ts --single
|
|
||||||
|
|
||||||
FROM ubuntu:24.04
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
ARG PWSH_VERSION=7.4.6
|
ARG PWSH_VERSION=7.4.6
|
||||||
@@ -84,6 +25,15 @@ RUN apt-get update \
|
|||||||
libssl-dev \
|
libssl-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install Node.js
|
||||||
|
RUN curl -fsSL -o /tmp/node.tar.xz \
|
||||||
|
"https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" \
|
||||||
|
&& tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 \
|
||||||
|
&& ln -sf /usr/local/bin/node /usr/bin/node \
|
||||||
|
&& ln -sf /usr/local/bin/npm /usr/bin/npm \
|
||||||
|
&& rm -f /tmp/node.tar.xz
|
||||||
|
|
||||||
|
# Install PowerShell
|
||||||
RUN curl -fsSL -o /tmp/powershell.tar.gz \
|
RUN curl -fsSL -o /tmp/powershell.tar.gz \
|
||||||
"https://github.com/PowerShell/PowerShell/releases/download/v${PWSH_VERSION}/powershell-${PWSH_VERSION}-linux-x64.tar.gz" \
|
"https://github.com/PowerShell/PowerShell/releases/download/v${PWSH_VERSION}/powershell-${PWSH_VERSION}-linux-x64.tar.gz" \
|
||||||
&& mkdir -p /opt/microsoft/powershell/7 \
|
&& mkdir -p /opt/microsoft/powershell/7 \
|
||||||
@@ -92,36 +42,37 @@ RUN curl -fsSL -o /tmp/powershell.tar.gz \
|
|||||||
&& ln -sf /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh \
|
&& ln -sf /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh \
|
||||||
&& rm -f /tmp/powershell.tar.gz
|
&& rm -f /tmp/powershell.tar.gz
|
||||||
|
|
||||||
|
# Install ttyd
|
||||||
RUN curl -fsSL -o /usr/local/bin/ttyd \
|
RUN curl -fsSL -o /usr/local/bin/ttyd \
|
||||||
"https://github.com/tsl0922/ttyd/releases/download/${TTYD_VERSION}/ttyd.x86_64" \
|
"https://github.com/tsl0922/ttyd/releases/download/${TTYD_VERSION}/ttyd.x86_64" \
|
||||||
&& chmod +x /usr/local/bin/ttyd
|
&& chmod +x /usr/local/bin/ttyd
|
||||||
|
|
||||||
RUN curl -fsSL -o /tmp/node.tar.xz \
|
# Download OpenCode CLI from GitHub releases
|
||||||
"https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" \
|
# This will download the latest release - requires the release to exist first
|
||||||
&& tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 \
|
RUN curl -fsSL -L -o /usr/local/bin/opencode \
|
||||||
&& ln -sf /usr/local/bin/node /usr/bin/node \
|
"https://github.com/southseact-3d/shopify-ai-backup/releases/latest/download/opencode-linux-x64" \
|
||||||
&& ln -sf /usr/local/bin/npm /usr/bin/npm \
|
&& chmod +x /usr/local/bin/opencode \
|
||||||
&& rm -f /tmp/node.tar.xz
|
&& opencode --version
|
||||||
|
|
||||||
COPY --from=builder /opt/opencode-src/opencode/packages/opencode/dist/opencode-linux-x64/bin/opencode /usr/local/bin/opencode
|
|
||||||
|
|
||||||
RUN chmod +x /usr/local/bin/opencode
|
|
||||||
|
|
||||||
|
# Setup PowerShell profile
|
||||||
RUN mkdir -p /root/.config/powershell
|
RUN mkdir -p /root/.config/powershell
|
||||||
COPY profile/Microsoft.PowerShell_profile.ps1 /root/.config/powershell/Microsoft.PowerShell_profile.ps1
|
COPY profile/Microsoft.PowerShell_profile.ps1 /root/.config/powershell/Microsoft.PowerShell_profile.ps1
|
||||||
RUN chmod 644 /root/.config/powershell/Microsoft.PowerShell_profile.ps1
|
RUN chmod 644 /root/.config/powershell/Microsoft.PowerShell_profile.ps1
|
||||||
|
|
||||||
|
# Copy scripts
|
||||||
COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
|
COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
COPY scripts/healthcheck.sh /usr/local/bin/healthcheck.sh
|
COPY scripts/healthcheck.sh /usr/local/bin/healthcheck.sh
|
||||||
COPY scripts/diagnostic-logger.sh /usr/local/bin/diagnostic-logger.sh
|
COPY scripts/diagnostic-logger.sh /usr/local/bin/diagnostic-logger.sh
|
||||||
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/healthcheck.sh /usr/local/bin/diagnostic-logger.sh
|
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/healthcheck.sh /usr/local/bin/diagnostic-logger.sh
|
||||||
|
|
||||||
|
# Copy webchat
|
||||||
COPY chat /opt/webchat
|
COPY chat /opt/webchat
|
||||||
RUN cd /opt/webchat && npm install --production && chmod -R 755 /opt/webchat
|
RUN cd /opt/webchat && npm install --production && chmod -R 755 /opt/webchat
|
||||||
|
|
||||||
COPY chat_v2 /opt/webchat_v2
|
COPY chat_v2 /opt/webchat_v2
|
||||||
RUN chmod -R 755 /opt/webchat_v2
|
RUN chmod -R 755 /opt/webchat_v2
|
||||||
|
|
||||||
|
# Create data directories
|
||||||
RUN mkdir -p /home/web/data \
|
RUN mkdir -p /home/web/data \
|
||||||
&& mkdir -p /var/log/shopify-ai \
|
&& mkdir -p /var/log/shopify-ai \
|
||||||
&& chown -R root:root /home/web/data /var/log/shopify-ai
|
&& chown -R root:root /home/web/data /var/log/shopify-ai
|
||||||
|
|||||||
Reference in New Issue
Block a user