-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add ci action to build the video worker image, update helm chart to
add video-worker
- Loading branch information
Showing
3 changed files
with
117 additions
and
0 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 |
---|---|---|
|
@@ -753,3 +753,52 @@ jobs: | |
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
video-worker: | ||
name: Push Video worker | ||
runs-on: ${{ matrix.runner }} | ||
strategy: | ||
matrix: | ||
runner: [blacksmith-8vcpu-ubuntu-2204] | ||
platform: [linux/amd64] | ||
exclude: | ||
- runner: blacksmith-8vcpu-ubuntu-2204 | ||
platform: linux/arm64 | ||
- runner: blacksmith-8vcpu-ubuntu-2204-arm | ||
platform: linux/amd64 | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v4 | ||
|
||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Setup buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
# list of Docker images to use as base name for tags | ||
images: | | ||
trieve/video-worker | ||
tags: | | ||
type=raw,latest | ||
type=sha | ||
- name: Build and push Docker image | ||
uses: useblacksmith/[email protected] | ||
with: | ||
platforms: ${{ matrix.platform }} | ||
context: server/ | ||
file: ./server/Dockerfile.video-worker | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,25 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: video-worker | ||
labels: | ||
app.kubernetes.io/name: video-worker | ||
app.kubernetes.io/instance: {{ $.Release.Name }} | ||
spec: | ||
replicas: {{ $.Values.containers.video_worker.replicas | default 1 }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: video-worker | ||
app.kubernetes.io/instance: {{ $.Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: video-worker | ||
app.kubernetes.io/instance: {{ $.Release.Name }} | ||
spec: | ||
containers: | ||
- name: video-worker | ||
image: {{ printf "%s:%s" "trieve/video-worker" $.Values.containers.video_worker.tag }} | ||
envFrom: | ||
- configMapRef: | ||
name: trieve-server-config |
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,43 @@ | ||
FROM rust:1.81-slim-bookworm AS chef | ||
# We only pay the installation cost once, | ||
# it will be cached from the second build onwards | ||
RUN apt-get update -y && apt-get -y install pkg-config libssl-dev libpq-dev g++ curl | ||
RUN cargo install cargo-chef | ||
WORKDIR /app | ||
|
||
FROM chef AS planner | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef AS builder | ||
COPY --from=planner /app/recipe.json recipe.json | ||
# Build dependencies - this is the caching Docker layer! | ||
RUN cargo chef cook --release --recipe-path recipe.json --bin "video-worker" | ||
# Build application | ||
COPY . . | ||
RUN cargo build --release --features "runtime-env" --bin "video-worker" | ||
|
||
FROM debian:bookworm-slim AS runtime | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update -y; \ | ||
apt-get install -y \ | ||
pkg-config \ | ||
build-essential\ | ||
libssl-dev \ | ||
libpq-dev \ | ||
ca-certificates \ | ||
curl \ | ||
redis-tools \ | ||
; | ||
|
||
RUN curl -fsSLO https://github.com/subtrace/subtrace/releases/download/b143/subtrace-linux-amd64 \ | ||
&& chmod +x ./subtrace-linux-amd64 | ||
|
||
COPY ./migrations/ /app/migrations | ||
COPY --from=builder /app/target/release/video-worker /app/video-worker | ||
|
||
|
||
EXPOSE 8090 | ||
ENTRYPOINT ["/app/video-worker"] |