Skip to content

Commit 14ae2ec

Browse files
authored
Use different ECR repo per env for the frontend (#4203)
1 parent 307b478 commit 14ae2ec

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ jobs:
274274
id: image
275275
run: |
276276
set +e
277-
aws ecr describe-images --repository-name=pythonit/pycon-frontend --image-ids=imageTag=${{ steps.git.outputs.githash }}
277+
aws ecr describe-images --repository-name=pythonit/${{ fromJSON('["pastaporto", "production"]')[github.ref == 'refs/heads/main'] }}-pycon-frontend --image-ids=imageTag=${{ steps.git.outputs.githash }}
278278
if [[ $? == 0 ]]; then
279279
echo "image_exists=1" >> $GITHUB_OUTPUT
280280
else
@@ -315,7 +315,7 @@ jobs:
315315
builder: ${{ steps.buildx.outputs.name }}
316316
provenance: false
317317
push: true
318-
tags: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-central-1.amazonaws.com/pythonit/pycon-frontend:${{ steps.git.outputs.githash }}
318+
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 }}
319319
cache-from: type=local,src=/tmp/.buildx-cache
320320
cache-to: type=local,dest=/tmp/.buildx-cache
321321
platforms: linux/arm64

infrastructure/applications/pycon_frontend/repo.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
data "aws_ecr_repository" "repo" {
2-
name = "pythonit/pycon-frontend"
1+
resource "aws_ecr_repository" "repo" {
2+
name = "pythonit/${terraform.workspace}-pycon-frontend"
33
}
44

55
data "aws_ecr_image" "image" {
6-
repository_name = data.aws_ecr_repository.repo.name
6+
repository_name = aws_ecr_repository.repo.name
77
image_tag = data.external.githash.result.githash
88
}
99

infrastructure/applications/pycon_frontend/task.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ resource "aws_ecs_task_definition" "pycon_frontend" {
1010
container_definitions = jsonencode([
1111
{
1212
name = "frontend"
13-
image = "${data.aws_ecr_repository.repo.repository_url}@${data.aws_ecr_image.image.image_digest}"
13+
image = "${aws_ecr_repository.repo.repository_url}@${data.aws_ecr_image.image.image_digest}"
1414
memoryReservation = local.is_prod ? 400 : 10
1515
essential = true
1616

0 commit comments

Comments
 (0)