-
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.
Merge pull request #75 from sul-dlss/build-image
Add Github Action deploy
- Loading branch information
Showing
5 changed files
with
122 additions
and
32 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,27 @@ | ||
# Build and deploy a Docker image to the production AWS environment | ||
# when a new release has been created. | ||
|
||
name: Deploy to Production | ||
|
||
on: | ||
release: | ||
types: | ||
published | ||
|
||
jobs: | ||
deploy-prod: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build and push Docker image to production | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_PRODUCTION }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_PRODUCTION }} | ||
AWS_ECR_DOCKER_REPO: ${{ secrets.AWS_ECR_DOCKER_REPO_PRODUCTION }} | ||
run: | | ||
echo "production deploy not yet enabled" | ||
# uncomment this when the keys are avaialable! | ||
# ./deploy.sh |
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,31 @@ | ||
# Build and deploy a Docker image to development and staging AWS environments | ||
# when a tagged version is created during weekly dependency updates. | ||
|
||
name: Deploy | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'rel-*-*-*' | ||
|
||
jobs: | ||
deploy-stage-qa: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build and push Docker image to development (qa in SDR) | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEVELOPMENT }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEVELOPMENT }} | ||
AWS_ECR_DOCKER_REPO: ${{ secrets.AWS_ECR_DOCKER_REPO_DEVELOPMENT }} | ||
run: ./deploy.sh | ||
|
||
- name: Build and push Docker image to staging | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }} | ||
AWS_ECR_DOCKER_REPO: ${{ secrets.AWS_ECR_DOCKER_REPO_STAGING }} | ||
run: ./deploy.sh |
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,35 @@ | ||
#!/bin/bash | ||
|
||
# The following environment variables will need to be set in order to push the | ||
# new speech-to-text Docker image: | ||
# | ||
# - AWS_ACCESS_KEY_ID: the access key for the speech-to-text user | ||
# - AWS_SECRET_ACCESS_KEY: the secret key for the speech-to-text user | ||
# - AWS_ECR_DOCKER_REPO: the Elastic Compute Registry URL for the Docker repository | ||
# | ||
# The values can be obtained by running `terraform output` in the relevant portion of | ||
# the Terraform configuration. | ||
|
||
# Exit immediately if something doesn't work | ||
|
||
set -e | ||
|
||
# Download the Whisper large-v3 model, which is what we use by default. Building | ||
# the image with the model in it already will speed up processing since whisper | ||
# won't need to pull it dynamically. | ||
|
||
wget --timestamping --directory whisper_models https://openaipublic.azureedge.net/main/whisper/models/e5b1a55b89c1367dacf97e3e19bfd829a01529dbfdeefa8caeb59b3f1b81dadb/large-v3.pt | ||
|
||
# Log in to ECR | ||
|
||
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin $AWS_ECR_DOCKER_REPO | ||
|
||
# Build the image for Linux (not really needed when running in Github Actions) | ||
|
||
docker build -t speech-to-text --platform="linux/amd64" . | ||
|
||
# Tag and push the image to ECR | ||
|
||
docker tag speech-to-text $AWS_ECR_DOCKER_REPO | ||
|
||
docker push $AWS_ECR_DOCKER_REPO |
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