Skip to content

Commit

Permalink
Update docker-deploy-prod.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Duncan Ragsdale <88173870+Thistleman@users.noreply.github.com>
  • Loading branch information
Thistleman committed May 1, 2024
1 parent cc76dc6 commit c245fe5
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions .github/workflows/docker-deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
name: Deploy Production
on:
push:
tags:
- v*.*.*
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
environment: Build
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install SSH key
uses: shimataro/ssh-key-action@v2
Expand All @@ -20,7 +19,7 @@ jobs:
if_key_exists: fail # replace / ignore / fail; optional (defaults to fail)

- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand All @@ -38,7 +37,7 @@ jobs:
python3 -m invoke test --junit --enforce-percent 99
- name: Store test results as artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: store test results
path: test-results
Expand All @@ -57,7 +56,7 @@ jobs:
DOCKER_BUILDKIT: "1"
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install SSH key
uses: shimataro/ssh-key-action@v2
Expand All @@ -74,7 +73,7 @@ jobs:
sudo chmod o+x /root/
- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand All @@ -83,15 +82,15 @@ jobs:
python -m pip install --upgrade pip
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PROD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PROD_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
uses: aws-actions/amazon-ecr-login@v2

# uses repository in your authorized registry to push to.
# sign in to your ecr page for a list of all your repositories.
Expand All @@ -107,7 +106,7 @@ jobs:
export DOCKER_BUILDKIT=1
docker build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
echo "IMAGE=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_ENV
# needed for the task-definition.json file, update task family here
# can also use the CLI to manually generate the task
Expand All @@ -121,7 +120,7 @@ jobs:
with:
task-definition: task-definition.json
container-name: 'openfido-prod-workflow-task'
image: ${{ steps.build-image.outputs.image }}
image: ${{ env.IMAGE }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
Expand All @@ -139,7 +138,7 @@ jobs:
DOCKER_BUILDKIT: "1"
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install SSH key
uses: shimataro/ssh-key-action@v2
Expand All @@ -156,7 +155,7 @@ jobs:
sudo chmod o+x /root/
- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand All @@ -165,15 +164,15 @@ jobs:
python -m pip install --upgrade pip
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PROD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PROD_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
uses: aws-actions/amazon-ecr-login@v2

# uses repository in your authorized registry to push to.
# sign in to your ecr page for a list of all your repositories.
Expand All @@ -189,7 +188,7 @@ jobs:
export DOCKER_BUILDKIT=1
docker build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile.worker .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
echo "IMAGE=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_ENV
# needed for the task-definition.json file, update task family here
# can also use the CLI to manually generate the task
Expand All @@ -203,7 +202,7 @@ jobs:
with:
task-definition: task-definition.json
container-name: 'openfido-prod-workflow-worker-task'
image: ${{ steps.build-image.outputs.image }}
image: ${{ env.IMAGE }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
Expand All @@ -221,7 +220,7 @@ jobs:
DOCKER_BUILDKIT: "1"
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install SSH key
uses: shimataro/ssh-key-action@v2
Expand All @@ -238,7 +237,7 @@ jobs:
sudo chmod o+x /root/
- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand All @@ -247,15 +246,15 @@ jobs:
python -m pip install --upgrade pip
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PROD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PROD_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
uses: aws-actions/amazon-ecr-login@v2

# uses repository in your authorized registry to push to.
# sign in to your ecr page for a list of all your repositories.
Expand All @@ -271,7 +270,7 @@ jobs:
export DOCKER_BUILDKIT=1
docker build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile.rabbitmq .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
echo "IMAGE=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_ENV
# needed for the task-definition.json file, update task family here
# can also use the CLI to manually generate the task
Expand All @@ -285,7 +284,7 @@ jobs:
with:
task-definition: task-definition.json
container-name: 'openfido-prod-rabbitmq-task'
image: ${{ steps.build-image.outputs.image }}
image: ${{ env.IMAGE }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
Expand Down

0 comments on commit c245fe5

Please sign in to comment.