mirror of
https://github.com/open-webui/oikb.git
synced 2026-10-19 07:13:34 +00:00
refac
Some checks failed
Docker (GHCR) / read-version (push) Has been cancelled
Docker (GHCR) / build-dev (amd64, Dockerfile, default, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-dev (amd64, Dockerfile.alpine, alpine, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-dev (arm64, Dockerfile, default, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / build-dev (arm64, Dockerfile.alpine, alpine, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / merge-dev (push) Has been cancelled
Docker (GHCR) / merge-dev-alpine (push) Has been cancelled
Docker (GHCR) / build-release (amd64, Dockerfile, default, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-release (amd64, Dockerfile.alpine, alpine, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-release (arm64, Dockerfile, default, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / build-release (arm64, Dockerfile.alpine, alpine, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / merge-release (push) Has been cancelled
Docker (GHCR) / merge-release-alpine (push) Has been cancelled
Some checks failed
Docker (GHCR) / read-version (push) Has been cancelled
Docker (GHCR) / build-dev (amd64, Dockerfile, default, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-dev (amd64, Dockerfile.alpine, alpine, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-dev (arm64, Dockerfile, default, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / build-dev (arm64, Dockerfile.alpine, alpine, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / merge-dev (push) Has been cancelled
Docker (GHCR) / merge-dev-alpine (push) Has been cancelled
Docker (GHCR) / build-release (amd64, Dockerfile, default, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-release (amd64, Dockerfile.alpine, alpine, linux/amd64, ubuntu-latest) (push) Has been cancelled
Docker (GHCR) / build-release (arm64, Dockerfile, default, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / build-release (arm64, Dockerfile.alpine, alpine, linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Docker (GHCR) / merge-release (push) Has been cancelled
Docker (GHCR) / merge-release-alpine (push) Has been cancelled
This commit is contained in:
parent
1287e660b0
commit
f99d2e66e7
3 changed files with 152 additions and 15 deletions
107
.github/workflows/docker.yml
vendored
107
.github/workflows/docker.yml
vendored
|
|
@ -45,9 +45,23 @@ jobs:
|
|||
- platform: linux/amd64
|
||||
runner: ubuntu-latest
|
||||
arch: amd64
|
||||
flavor: default
|
||||
dockerfile: Dockerfile
|
||||
- platform: linux/arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
arch: arm64
|
||||
flavor: default
|
||||
dockerfile: Dockerfile
|
||||
- platform: linux/amd64
|
||||
runner: ubuntu-latest
|
||||
arch: amd64
|
||||
flavor: alpine
|
||||
dockerfile: Dockerfile.alpine
|
||||
- platform: linux/arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
arch: arm64
|
||||
flavor: alpine
|
||||
dockerfile: Dockerfile.alpine
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
|
@ -68,10 +82,11 @@ jobs:
|
|||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ${{ matrix.dockerfile }}
|
||||
platforms: ${{ matrix.platform }}
|
||||
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||
cache-from: type=gha,scope=dev-${{ matrix.arch }}
|
||||
cache-to: type=gha,mode=max,scope=dev-${{ matrix.arch }}
|
||||
cache-from: type=gha,scope=dev-${{ matrix.flavor }}-${{ matrix.arch }}
|
||||
cache-to: type=gha,mode=max,scope=dev-${{ matrix.flavor }}-${{ matrix.arch }}
|
||||
|
||||
- name: Export digest
|
||||
run: |
|
||||
|
|
@ -82,7 +97,7 @@ jobs:
|
|||
- name: Upload digest
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: digests-dev-${{ matrix.arch }}
|
||||
name: digests-dev-${{ matrix.flavor }}-${{ matrix.arch }}
|
||||
path: /tmp/digests/*
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
|
@ -96,7 +111,7 @@ jobs:
|
|||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: /tmp/digests
|
||||
pattern: digests-dev-*
|
||||
pattern: digests-dev-default-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
|
|
@ -117,6 +132,36 @@ jobs:
|
|||
docker buildx imagetools create $(printf -- '-t %s ' "${tags[@]}") \
|
||||
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
|
||||
|
||||
merge-dev-alpine:
|
||||
if: github.ref == 'refs/heads/main'
|
||||
needs: build-dev
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download digests
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: /tmp/digests
|
||||
pattern: digests-dev-alpine-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create dev Alpine multi-arch manifest
|
||||
working-directory: /tmp/digests
|
||||
run: |
|
||||
SHORT_SHA="${GITHUB_SHA::7}"
|
||||
tags=("${{ env.IMAGE }}:dev-alpine" "${{ env.IMAGE }}:dev-${SHORT_SHA}-alpine")
|
||||
docker buildx imagetools create $(printf -- '-t %s ' "${tags[@]}") \
|
||||
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
|
||||
|
||||
build-release:
|
||||
needs: read-version
|
||||
if: github.ref == 'refs/heads/release'
|
||||
|
|
@ -127,9 +172,23 @@ jobs:
|
|||
- platform: linux/amd64
|
||||
runner: ubuntu-latest
|
||||
arch: amd64
|
||||
flavor: default
|
||||
dockerfile: Dockerfile
|
||||
- platform: linux/arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
arch: arm64
|
||||
flavor: default
|
||||
dockerfile: Dockerfile
|
||||
- platform: linux/amd64
|
||||
runner: ubuntu-latest
|
||||
arch: amd64
|
||||
flavor: alpine
|
||||
dockerfile: Dockerfile.alpine
|
||||
- platform: linux/arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
arch: arm64
|
||||
flavor: alpine
|
||||
dockerfile: Dockerfile.alpine
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
|
@ -150,10 +209,11 @@ jobs:
|
|||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ${{ matrix.dockerfile }}
|
||||
platforms: ${{ matrix.platform }}
|
||||
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||
cache-from: type=gha,scope=release-${{ matrix.arch }}
|
||||
cache-to: type=gha,mode=max,scope=release-${{ matrix.arch }}
|
||||
cache-from: type=gha,scope=release-${{ matrix.flavor }}-${{ matrix.arch }}
|
||||
cache-to: type=gha,mode=max,scope=release-${{ matrix.flavor }}-${{ matrix.arch }}
|
||||
|
||||
- name: Export digest
|
||||
run: |
|
||||
|
|
@ -164,7 +224,7 @@ jobs:
|
|||
- name: Upload digest
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: digests-release-${{ matrix.arch }}
|
||||
name: digests-release-${{ matrix.flavor }}-${{ matrix.arch }}
|
||||
path: /tmp/digests/*
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
|
@ -178,7 +238,7 @@ jobs:
|
|||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: /tmp/digests
|
||||
pattern: digests-release-*
|
||||
pattern: digests-release-default-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
|
|
@ -199,3 +259,34 @@ jobs:
|
|||
tags=("${{ env.IMAGE }}:latest" "${{ env.IMAGE }}:${VERSION}" "${{ env.IMAGE }}:${MAJOR_MINOR}")
|
||||
docker buildx imagetools create $(printf -- '-t %s ' "${tags[@]}") \
|
||||
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
|
||||
|
||||
merge-release-alpine:
|
||||
needs: [read-version, build-release]
|
||||
if: github.ref == 'refs/heads/release'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download digests
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: /tmp/digests
|
||||
pattern: digests-release-alpine-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create release Alpine multi-arch manifest
|
||||
working-directory: /tmp/digests
|
||||
run: |
|
||||
VERSION="${{ needs.read-version.outputs.version }}"
|
||||
MAJOR_MINOR="${VERSION%.*}"
|
||||
tags=("${{ env.IMAGE }}:alpine" "${{ env.IMAGE }}:latest-alpine" "${{ env.IMAGE }}:${VERSION}-alpine" "${{ env.IMAGE }}:${MAJOR_MINOR}-alpine")
|
||||
docker buildx imagetools create $(printf -- '-t %s ' "${tags[@]}") \
|
||||
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
|
||||
|
|
|
|||
16
Dockerfile
16
Dockerfile
|
|
@ -1,4 +1,4 @@
|
|||
FROM python:3.14-alpine3.23 AS builder
|
||||
FROM python:3.11-slim-bookworm AS builder
|
||||
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||
|
||||
|
|
@ -8,25 +8,27 @@ WORKDIR /app
|
|||
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
||||
uv sync --all-extras --no-install-project --no-dev
|
||||
uv sync --extra all --no-install-project --no-dev
|
||||
|
||||
COPY pyproject.toml LICENSE README.md ./
|
||||
COPY src/ ./src/
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --all-extras --no-dev
|
||||
uv sync --extra all --no-dev
|
||||
|
||||
|
||||
FROM python:3.14-alpine3.23
|
||||
FROM python:3.11-slim-bookworm
|
||||
LABEL org.opencontainers.image.description="CLI tool for syncing content to Open WebUI Knowledge Bases" \
|
||||
org.opencontainers.image.source="https://github.com/open-webui/oikb" \
|
||||
org.opencontainers.image.vendor="Open WebUI Inc." \
|
||||
org.opencontainers.image.licenses="MIT"
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
RUN apk add --no-cache ca-certificates \
|
||||
&& addgroup -g 1000 appuser \
|
||||
&& adduser -D -u 1000 -G appuser appuser
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& groupadd --gid 1000 appuser \
|
||||
&& useradd --uid 1000 --gid appuser --create-home --shell /usr/sbin/nologin appuser
|
||||
|
||||
COPY --from=builder --chown=appuser:appuser /app /app
|
||||
|
||||
|
|
|
|||
44
Dockerfile.alpine
Normal file
44
Dockerfile.alpine
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
FROM python:3.11-alpine3.23 AS builder
|
||||
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||
|
||||
ENV UV_LINK_MODE=copy
|
||||
ENV LD_LIBRARY_PATH=/usr/lib/llvm21/lib
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache build-base clang21-libclang pkgconf
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
||||
uv sync --extra all --no-install-project --no-dev
|
||||
|
||||
COPY pyproject.toml LICENSE README.md ./
|
||||
COPY src/ ./src/
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --extra all --no-dev
|
||||
|
||||
|
||||
FROM python:3.11-alpine3.23
|
||||
LABEL org.opencontainers.image.description="CLI tool for syncing content to Open WebUI Knowledge Bases" \
|
||||
org.opencontainers.image.source="https://github.com/open-webui/oikb" \
|
||||
org.opencontainers.image.vendor="Open WebUI Inc." \
|
||||
org.opencontainers.image.licenses="MIT"
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
RUN apk add --no-cache ca-certificates libstdc++ \
|
||||
&& addgroup -g 1000 appuser \
|
||||
&& adduser -D -u 1000 -G appuser appuser
|
||||
|
||||
COPY --from=builder --chown=appuser:appuser /app /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
USER appuser
|
||||
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["oikb"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue