Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .github/workflows/hrm-speech-to-text-ecs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,21 @@ jobs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Add licence
env:
PRODUCTION_PRIVATE_AI_LICENCE: ${{ secrets.PRODUCTION_PRIVATE_AI_LICENCE }}
run: |
touch ./hrm-domain/speech-to-text/limina/licence/license.json
echo "$PRODUCTION_PRIVATE_AI_LICENCE" >> ./hrm-domain/speech-to-text/limina/licence/license.json

shell: bash
- name: Log in to Private AI Registry
run: docker login -u ${{ secrets.PRODUCTION_PRIVATE_AI_DOCKER_USER }} -p ${{ secrets.PRODUCTION_PRIVATE_AI_DOCKER_PASSWORD }} crprivateaiprod.azurecr.io

- name: Build and Push proxy-service Docker Image
uses: docker/build-push-action@v7
with:
context: ./hrm-domain/speech-to-text/proxy-service
context: ./
file: ./hrm-domain/speech-to-text/proxy-service/Dockerfile
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY_PROXY }}:live,${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY_PROXY }}:latest,${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY_PROXY }}:${{ inputs.environment }}-speech-to-text-proxy-${{ github.sha }}
Expand All @@ -112,7 +120,7 @@ jobs:
- name: Build and Push pyannote Docker Image
uses: docker/build-push-action@v7
with:
context: ./hrm-domain/speech-to-text/pyannote
context: ./
file: ./hrm-domain/speech-to-text/pyannote/Dockerfile
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY_PYANNOTE }}:live,${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY_PYANNOTE }}:latest,${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY_PYANNOTE }}:${{ inputs.environment }}-speech-to-text-pyannote-${{ github.sha }}
Expand All @@ -121,7 +129,7 @@ jobs:
- name: Build and Push limina Docker Image
uses: docker/build-push-action@v7
with:
context: ./hrm-domain/speech-to-text/limina
context: ./
file: ./hrm-domain/speech-to-text/limina/Dockerfile
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY_LIMINA }}:live,${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY_LIMINA }}:latest,${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY_LIMINA }}:${{ inputs.environment }}-speech-to-text-limina-${{ github.sha }}
Expand All @@ -143,7 +151,6 @@ jobs:
needs: deploy_docker
name: Deploy to Amazon ECS
runs-on: ubuntu-latest
permissions: {}

env:
PROXY_IMAGE: ${{ needs.deploy_docker.outputs.proxy_image }}
Expand Down Expand Up @@ -194,7 +201,7 @@ jobs:
task-definition: ${{ steps.task-def-limina.outputs.task-definition }}
service: ${{ inputs.environment }}-speech-to-text
cluster: ${{ inputs.environment }}-speech-to-text-cluster
wait-for-service-stability: true
# wait-for-service-stability: true

# reconfigure AWS credentials to use the default region for SSM Parameter Store.
# aws-actions/configure-aws-credentials@v6 overrides env.AWS_DEFAULT_REGION, so
Expand Down
9 changes: 9 additions & 0 deletions hrm-domain/speech-to-text/limina/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@

FROM crprivateaiprod.azurecr.io/deid:4.0.0-cpu

ARG task_dir=hrm-domain/speech-to-text/limina

COPY ${task_dir}/entrypoint.sh /var/task/entrypoint.sh
COPY ${task_dir}/licence /app/license

WORKDIR /var/task

ENTRYPOINT ["/usr/bin/sh","/var/task/entrypoint.sh"]

EXPOSE 8080
15 changes: 15 additions & 0 deletions hrm-domain/speech-to-text/limina/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (C) 2021-2023 Technology Matters
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see https://www.gnu.org/licenses/.

cd /app && sh ./pai-entrypoint-cpu.sh && exit 0
Empty file.
41 changes: 27 additions & 14 deletions hrm-domain/speech-to-text/proxy-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,39 @@

FROM node:22-alpine AS build

WORKDIR /app
ARG task_dir=hrm-domain/speech-to-text/proxy-service

# This is a bit complicated by the need for access to the packages.
# We must have the full repo context for our docker build so we can
# copy the root packages so that the file: based
# dependency in package.json can be resolved
COPY packages /tmp/build/packages
COPY ${task_dir} /tmp/build/${task_dir}
COPY ${task_dir}/../tsconfig.json /tmp/build/${task_dir}/../tsconfig.json
# COPY ${task_dir}/../../tsconfig.json /tmp/build/${task_dir}/../../tsconfig.json
COPY package.json package-lock.json tsconfig.json tsconfig.base.json ${task_dir}/tsconfig.build.json /tmp/build/

RUN cd /tmp/build \
&& npm ci -w ${task_dir} -w packages/* --verbose \
&& npx tsc -b tsconfig.build.json --verbose \
&& mkdir -p /var/task/dist \
&& cp ${task_dir}/dist/*.js /var/task/dist/ \
&& cp -r packages /var/task/dist/ \
&& cp -r node_modules /var/task/dist/ \
# copy commands to run within the container
&& cp ${task_dir}/package.json /var/task/dist/ \
&& cp -r ${task_dir}/commands /var/task/dist/

COPY package*.json ./
RUN npm ci

COPY tsconfig.json ./
COPY src ./src
RUN npm run build

FROM node:22-alpine

WORKDIR /app

COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
COPY package.json ./
COPY --from=build /var/task /var/task

EXPOSE 3000

# HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
# CMD node -e "require('http').get('http://localhost:3000/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"
WORKDIR /var/task

ENV LOCAL_LIMINA_URI="http://localhost:8080"
ENV LOCAL_PYANNOTE_URI="http://localhost:8081"

CMD ["node", "dist/index.js"]
35 changes: 35 additions & 0 deletions hrm-domain/speech-to-text/proxy-service/commands/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (C) 2021-2023 Technology Matters
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/

// eslint-disable-next-line import/no-extraneous-dependencies
import yargs from 'yargs';

const main = () => {
console.info('Commands CLI');
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
yargs
.commandDir('.', {
exclude: /^(index|_)/, // Exclude files starting with 'index' or '_'
extensions: ['ts'],
})
.scriptName('commands-cli')
.demandCommand(1, 'Please provide a valid command')
.version(false)
.wrap(120)
.help().argv;
};

main();
26 changes: 26 additions & 0 deletions hrm-domain/speech-to-text/proxy-service/commands/limina.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (C) 2021-2023 Technology Matters
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/

export const command = 'limina <command>';
export const desc = 'endpoints for limina';
export const builder = function (yargs) {
return yargs.commandDir('limina', {
exclude: /^(index|_)/, // Exclude files starting with 'index' or '_'
extensions: ['ts'],
});
// .commandDir('common_cmds'); add more
};
// export const handler = function (argv) {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright (C) 2021-2023 Technology Matters
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/

export const command = 'healthcheck';
export const describe = '';

export const builder = {};

export const handler = async ({}) => {
console.info('Testing healthcheck endpoint');
try {
const result = await fetch(new URL(`${process.env.LOCAL_LIMINA_URI}/health`));
console.log(await result.json());
} catch (err) {
console.error(err);
}
};
26 changes: 26 additions & 0 deletions hrm-domain/speech-to-text/proxy-service/commands/pyannote.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (C) 2021-2023 Technology Matters
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/

export const command = 'pyannote <command>';
export const desc = 'endpoints for pyannote';
export const builder = function (yargs) {
return yargs.commandDir('pyannote', {
exclude: /^(index|_)/, // Exclude files starting with 'index' or '_'
extensions: ['ts'],
});
// .commandDir('common_cmds'); add more
};
// export const handler = function (argv) {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright (C) 2021-2023 Technology Matters
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/

export const command = 'healthcheck';
export const describe = '';

export const builder = {};

export const handler = async ({}) => {
console.info('Testing healthcheck endpoint');
try {
const result = await fetch(new URL(`${process.env.LOCAL_PYANNOTE_URI}/health`));
console.log(await result.json());
} catch (err) {
console.error(err);
}
};
Loading
Loading