Skip to content

Commit

Permalink
Use different ECR repo per env for the frontend (#4203)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoacierno authored Dec 7, 2024
1 parent 307b478 commit 14ae2ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ jobs:
id: image
run: |
set +e
aws ecr describe-images --repository-name=pythonit/pycon-frontend --image-ids=imageTag=${{ steps.git.outputs.githash }}
aws ecr describe-images --repository-name=pythonit/${{ fromJSON('["pastaporto", "production"]')[github.ref == 'refs/heads/main'] }}-pycon-frontend --image-ids=imageTag=${{ steps.git.outputs.githash }}
if [[ $? == 0 ]]; then
echo "image_exists=1" >> $GITHUB_OUTPUT
else
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
builder: ${{ steps.buildx.outputs.name }}
provenance: false
push: true
tags: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-central-1.amazonaws.com/pythonit/pycon-frontend:${{ steps.git.outputs.githash }}
tags: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-central-1.amazonaws.com/pythonit/${{ fromJSON('["pastaporto", "production"]')[github.ref == 'refs/heads/main'] }}-pycon-frontend:${{ steps.git.outputs.githash }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
platforms: linux/arm64
Expand Down
6 changes: 3 additions & 3 deletions infrastructure/applications/pycon_frontend/repo.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
data "aws_ecr_repository" "repo" {
name = "pythonit/pycon-frontend"
resource "aws_ecr_repository" "repo" {
name = "pythonit/${terraform.workspace}-pycon-frontend"
}

data "aws_ecr_image" "image" {
repository_name = data.aws_ecr_repository.repo.name
repository_name = aws_ecr_repository.repo.name
image_tag = data.external.githash.result.githash
}

Expand Down
2 changes: 1 addition & 1 deletion infrastructure/applications/pycon_frontend/task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ resource "aws_ecs_task_definition" "pycon_frontend" {
container_definitions = jsonencode([
{
name = "frontend"
image = "${data.aws_ecr_repository.repo.repository_url}@${data.aws_ecr_image.image.image_digest}"
image = "${aws_ecr_repository.repo.repository_url}@${data.aws_ecr_image.image.image_digest}"
memoryReservation = local.is_prod ? 400 : 10
essential = true

Expand Down

0 comments on commit 14ae2ec

Please sign in to comment.