Skip to content

Commit

Permalink
Combine build and push step
Browse files Browse the repository at this point in the history
  • Loading branch information
joekitsmith committed Nov 28, 2023
1 parent 08de8df commit c3073ca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 39 deletions.
26 changes: 3 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ jobs:
run: |
poetry run pre-commit run --all-files
build:
name: "Build"
build-push:
name: "Build and push"
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -68,24 +68,4 @@ jobs:
run: bash scripts/configure_dvc.sh

- name: Build containers
run: bash scripts/build-prod.sh

push:
name: "Push"
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::233044492909:role/SkillsTracker-GitHubActions
aws-region: eu-west-2

- name: Push to ECR
run: bash scripts/push-prod.sh
run: bash scripts/build-push-prod.sh
16 changes: 0 additions & 16 deletions scripts/build-prod.sh

This file was deleted.

2 changes: 2 additions & 0 deletions scripts/push-prod.sh → scripts/build-push-prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ECR_REPO_URI_FRONTEND="$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$ECR_RE

aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$ECR_REPO_NAME_FRONTEND

docker build -t "$ECR_REPO_URI_FRONTEND:latest" -f docker/frontend/Dockerfile .
docker push "$ECR_REPO_URI_FRONTEND:latest"

# API
Expand All @@ -17,4 +18,5 @@ ECR_REPO_URI_API="$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$ECR_REPO_NA

aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$ECR_REPO_NAME_API

docker build -t "$ECR_REPO_URI_API:latest" -f docker/api/Dockerfile .
docker push "$ECR_REPO_URI_API:latest"

0 comments on commit c3073ca

Please sign in to comment.