mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
ci: publish multi-arch ChatLab CLI image
This commit is contained in:
1 parent
21b40358c2
commit
5806a1fcb5
2 files changed
+78
No files matched your search
@@ -0,0 +1,26 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM node:24-bookworm-slim
|
||||
|
||||
ARG CHATLAB_VERSION
|
||||
|
||||
RUN test -n "$CHATLAB_VERSION" \
|
||||
&& apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends g++ make python3 \
|
||||
&& npm install --global --omit=dev "chatlab-cli@${CHATLAB_VERSION}" \
|
||||
&& npm cache clean --force \
|
||||
&& apt-get purge --yes --auto-remove g++ make python3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV CHATLAB_DATA_DIR=/data
|
||||
|
||||
RUN install -d -o node -g node /data
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
USER node
|
||||
|
||||
EXPOSE 3110
|
||||
|
||||
ENTRYPOINT ["chatlab"]
|
||||
CMD ["start", "--no-open", "--host", "0.0.0.0"]
|
||||
@@ -554,6 +554,58 @@ jobs:
|
||||
working-directory: apps/cli
|
||||
run: npm publish --ignore-scripts --provenance --tag ${{ needs.prepare_release.outputs.npm_tag }}
|
||||
|
||||
publish-docker:
|
||||
needs: [prepare_release, release, publish-cli]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout image definition
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
|
||||
- name: Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/chatlab-cli
|
||||
tags: |
|
||||
type=raw,value=${{ needs.prepare_release.outputs.version_tag }}
|
||||
type=raw,value=latest,enable=${{ needs.prepare_release.outputs.npm_tag == 'latest' }}
|
||||
labels: |
|
||||
org.opencontainers.image.source=https://github.com/${{ github.repository }}
|
||||
org.opencontainers.image.version=${{ needs.prepare_release.outputs.version_tag }}
|
||||
org.opencontainers.image.revision=${{ github.sha }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
file: .github/docker/chatlab-cli.Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
CHATLAB_VERSION=${{ needs.prepare_release.outputs.version }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha,scope=chatlab-cli
|
||||
cache-to: type=gha,mode=max,scope=chatlab-cli
|
||||
|
||||
cleanup-r2:
|
||||
needs: [prepare_release, release]
|
||||
if: needs.prepare_release.outputs.is_prerelease == 'false'
|
||||
|
||||
Reference in new issue
Block a user