forked from xenova/whisper-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ft: add ci build to automate deployment
- Loading branch information
1 parent
824bcdd
commit dbce678
Showing
9 changed files
with
181 additions
and
9 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,79 @@ | ||
name: "Docker build & push to Artifact Registry" | ||
description: "Builds the docker image and pushes it to Google Artifact Registry" | ||
on: | ||
workflow_call: | ||
inputs: | ||
repo: | ||
description: "Repository name" | ||
required: true | ||
registry: | ||
description: "Google Artifact registry" | ||
required: false | ||
default: "docker.pkg.dev" | ||
dockerfile: | ||
description: "Dockerfile path" | ||
required: false | ||
default: "Dockerfile" | ||
context: | ||
description: "Docker context" | ||
required: false | ||
default: "." | ||
project_id: | ||
description: "Google project ID" | ||
required: true | ||
google_key: | ||
description: "Google service account key in BASE64" | ||
required: true | ||
outputs: | ||
imageid: | ||
description: "Image ID" | ||
value: ${{ jobs.push.outputs.imageid }} | ||
tag: | ||
description: "Image tag" | ||
value: ${{ jobs.push.outputs.tag }} | ||
jobs: | ||
push: | ||
name: "Build & Push" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
imageid: | ||
description: "Image ID" | ||
value: ${{ steps.build.outputs.imageid }} | ||
tag: | ||
description: "Image tag" | ||
value: ${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }} | ||
steps: | ||
- name: Docker login to Google Cloud | ||
id: vars | ||
run: | | ||
echo "$B64_GOOGLE_KEY" | docker login -u _json_key_base64 --password-stdin https://$REGISTRY | ||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | ||
echo "branch=$(echo "$branch" | tr '/\' '-')" >> $GITHUB_OUTPUT | ||
shell: bash | ||
env: | ||
B64_GOOGLE_KEY: ${{ inputs.google_key }} | ||
REGISTRY: ${{ inputs.registry }} | ||
# - name: Check image | ||
# id: image_exists | ||
# continue-on-error: true | ||
# uses: cloudposse/github-action-docker-image-exists@main | ||
# with: | ||
# registry: ${{ inputs.registry }} | ||
# image_name: ${{ inputs.project_id }}/${{ inputs.repo }} | ||
# tag: ${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }} | ||
- uses: docker/setup-buildx-action@v3 | ||
if: steps.image_exists.outcome == 'failure' | ||
- uses: docker/build-push-action@v5 | ||
# if: steps.image_exists.outcome == 'failure' | ||
id: build | ||
with: | ||
context: ${{ inputs.context }} | ||
file: ${{ inputs.dockerfile }} | ||
# cache-from: type=gha | ||
# cache-to: type=gha,mode=max | ||
push: true | ||
labels: | | ||
ci.run_id=${{ github.run_id }} | ||
tags: | | ||
${{ inputs.registry }}/${{ inputs.project_id }}/${{ inputs.repo }}:${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }} |
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,40 @@ | ||
name: CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
push-backend: | ||
name: Build backend | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.build.outputs.tag }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ../composite/build-push-gcloud/action.yaml | ||
id: build | ||
with: | ||
google_key: ${{ secrets.GCLOUD_SECRET_KEY }} | ||
repo: services/whisper-notes-backend | ||
dockerfile: backend.Dockerfile | ||
registry: europe-north1-docker.pkg.dev | ||
project_id: ${{ secrets.GCLOUD_PROJECT }} | ||
push-frontend: | ||
name: Build frontend | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.build.outputs.tag }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ../composite/build-push-gcloud/action.yaml | ||
id: build | ||
with: | ||
google_key: ${{ secrets.GCLOUD_SECRET_KEY }} | ||
repo: services/whisper-notes-frontend | ||
dockerfile: frontend.Dockerfile | ||
registry: europe-north1-docker.pkg.dev | ||
project_id: ${{ secrets.GCLOUD_PROJECT }} |
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,29 @@ | ||
FROM node:23-alpine AS build | ||
|
||
WORKDIR /build | ||
COPY backend . | ||
COPY protos ./protos | ||
|
||
RUN yarn --frozen-lockfile | ||
|
||
RUN yarn proto-loader-gen-types \ | ||
--grpcLib=@grpc/grpc-js \ | ||
--outDir=./src/generated/ \ | ||
./protos/*.proto | ||
|
||
RUN yarn build | ||
|
||
FROM node:23-alpine AS app | ||
|
||
RUN apk add --no-cache tini | ||
|
||
WORKDIR /app | ||
COPY --from=build /build/node_modules ./node_modules | ||
COPY --from=build /build/dist ./dist | ||
COPY --from=build /build/protos ./protos | ||
|
||
ENV PROTO_PATH="/app/protos" | ||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["/sbin/tini", "--"] | ||
CMD [ "node", "dist/server.js" ] |
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,21 @@ | ||
FROM node:23-alpine AS build | ||
|
||
WORKDIR /build | ||
COPY frontend . | ||
COPY protos ./protos | ||
|
||
RUN yarn --frozen-lockfile | ||
|
||
RUN yarn protoc \ | ||
--ts_out src/generated/ \ | ||
--ts_opt long_type_string \ | ||
--proto_path ./protos \ | ||
--ts_opt ts_nocheck \ | ||
./protos/*.proto | ||
|
||
RUN yarn build | ||
|
||
FROM flashspys/nginx-static:latest AS app | ||
|
||
COPY --from=build /build/dist /static | ||
EXPOSE 80 |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
{"root":["./src/App.tsx","./src/index.tsx","./src/vite-env.d.ts","./src/components/AudioManager.tsx","./src/components/AudioPlayer.tsx","./src/components/AudioRecorder.tsx","./src/components/Progress.tsx","./src/components/TranscribeButton.tsx","./src/components/Transcript.tsx","./src/components/modal/Modal.tsx","./src/components/modal/UrlInput.tsx","./src/hooks/useTranscriber.ts","./src/hooks/useWorker.ts","./src/utils/AudioUtils.ts","./src/utils/BlobFix.ts","./src/utils/Constants.ts"],"errors":true,"version":"5.6.2"} | ||
{"root":["./src/app.tsx","./src/index.tsx","./src/vite-env.d.ts","./src/components/audiomanager.tsx","./src/components/audioplayer.tsx","./src/components/audiorecorder.tsx","./src/components/progress.tsx","./src/components/transcribebutton.tsx","./src/components/transcript.tsx","./src/components/modal/modal.tsx","./src/components/modal/urlinput.tsx","./src/generated/notes.client.ts","./src/generated/notes.ts","./src/hooks/usetranscriber.ts","./src/hooks/useworker.ts","./src/services/index.ts","./src/utils/audioutils.ts","./src/utils/blobfix.ts","./src/utils/constants.ts"],"version":"5.6.3"} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
{"root":["./vite.config.ts"],"version":"5.6.2"} | ||
{"root":["./vite.config.ts"],"version":"5.6.3"} |
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