-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: pagefind worker Dockerfile and ci action
- Loading branch information
Showing
4 changed files
with
124 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 |
---|---|---|
|
@@ -802,3 +802,53 @@ jobs: | |
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
|
||
pagefind-worker: | ||
name: Push Pagefind Index 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/pagefind-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.pagefind-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: pagefind-worker | ||
labels: | ||
app.kubernetes.io/name: pagefind-worker | ||
app.kubernetes.io/instance: {{ $.Release.Name }} | ||
spec: | ||
replicas: {{ $.Values.containers.crawl_worker.replicas | default 1 }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: pagefind-worker | ||
app.kubernetes.io/instance: {{ $.Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: pagefind-worker | ||
app.kubernetes.io/instance: {{ $.Release.Name }} | ||
spec: | ||
containers: | ||
- name: pagefind-worker | ||
image: {{ printf "%s:%s" "trieve/pagefind-worker" $.Values.containers.pagefind_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
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 "pagefind-worker" | ||
# Build application | ||
COPY . . | ||
RUN cargo build --release --features "runtime-env" --bin "pagefind-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/pagefind-worker /app/pagefind-worker | ||
|
||
|
||
EXPOSE 8090 | ||
ENTRYPOINT ["/app/pagefind-worker"] |