-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
133 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Build and Publish Docker Image | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["release"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
build: | ||
# if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Rust | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: stable | ||
|
||
- name: Build blue_onyx binaries | ||
run: | | ||
cargo build --release --bin blue_onyx | ||
cargo build --release --bin blue_onyx_download_models | ||
- name: Download models | ||
run: | | ||
./target/release/blue_onyx_download_models /tmp/models | ||
./target/release/blue_onyx_download_models /tmp/models custom-model | ||
- name: Prepare Docker context | ||
run: | | ||
mkdir docker-context | ||
cp ./target/release/blue_onyx docker-context/ | ||
cp ./target/release/libonnxruntime.so docker-context/ | ||
cp -r /tmp/models docker-context/models | ||
cp ./Dockerfile docker-context/ | ||
- name: Get blue_onyx version | ||
id: get_version | ||
run: | | ||
VERSION=$(./target/release/blue_onyx --version | awk '{print $2}') | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: docker-context | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/blue_onyx:latest | ||
ghcr.io/${{ github.repository_owner }}/blue_onyx:${{ env.VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM debian:trixie-slim | ||
|
||
LABEL maintainer="[email protected]" | ||
LABEL description="Blue Onyx docker container" | ||
|
||
ENV TARGET_FOLDER=/models | ||
|
||
# Install dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends openssl && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Create non-root user | ||
RUN useradd --create-home --no-log-init blueonyx | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy application files and set ownership | ||
COPY --chown=blueonyx:blueonyx blue_onyx libonnxruntime.so ./ | ||
|
||
# Copy model files and set ownership | ||
COPY --chown=blueonyx:blueonyx models/* ./ | ||
|
||
# Switch to non-root user | ||
USER blueonyx | ||
|
||
# Expose port | ||
EXPOSE 32168 | ||
|
||
# Define entrypoint | ||
ENTRYPOINT ["./blue_onyx"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters