Skip to content

Commit

Permalink
chore: adjusts docker image configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoglm committed Dec 30, 2024
1 parent 9a4b41f commit 3cffccd
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 20 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/lint_tests_and_sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
- name: Instalar Docker Compose Standalone
run: |
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
id: configure-ecr
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
aws-access-key-id: ${{ secrets.DOCKER_IMAGES_AWS_PULL_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DOCKER_IMAGES_AWS_PULL_SECRET_ACCESS_KEY }}
aws-region: us-east-1
mask-aws-account-id: "no"

- name: Login no Elastic Container Registry / ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Run tests
run: make test-ci
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/login-ecr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Reusable steps for ecr login job

on:
workflow_call:
secrets:
AWS_PULL_ECR_ACCESS_KEY_ID:
required: true
AWS_PULL_ECR_SECRET_ACCESS_KEY:
required: true
outputs:
registry:
description: "registry from login"
value: ${{ jobs.configure_aws.outputs.registry }}
docker_username:
description: "registry from login"
value: ${{ jobs.configure_aws.outputs.docker_username }}
docker_password:
description: "registry from login"
value: ${{ jobs.configure_aws.outputs.docker_password }}

jobs:
configure_aws:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
id: configure-ecr
with:
aws-access-key-id: ${{ secrets.AWS_PULL_ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_PULL_ECR_SECRET_ACCESS_KEY }}
aws-region: us-east-1
mask-aws-account-id: "no"
- name: Login no Elastic Container Registry / ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
outputs:
registry: ${{ steps.login-ecr.outputs.registry }}/pay-docker-base-images
docker_username: ${{ steps.login-ecr.outputs.docker_username }} # More information on these outputs can be found below in the 'Docker Credentials' section
docker_password: ${{ steps.login-ecr.outputs.docker_password }}
16 changes: 16 additions & 0 deletions .github/workflows/superbowleto_build_and_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ jobs:
- name: checkout
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
id: configure-ecr
with:
aws-access-key-id: ${{ secrets.DOCKER_IMAGES_AWS_PULL_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DOCKER_IMAGES_AWS_PULL_SECRET_ACCESS_KEY }}
aws-region: us-east-1
mask-aws-account-id: "no"

- name: Login no Elastic Container Registry / ECR
uses: aws-actions/amazon-ecr-login@v1

- name: Instalar Docker Compose Standalone
run: |
docker pull 697525377503.dkr.ecr.us-east-1.amazonaws.com/pay-docker-base-images:pagarme-node8.9
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM pagarme/docker-nodejs:8.9
FROM 697525377503.dkr.ecr.us-east-1.amazonaws.com/pay-docker-base-images:pagarme-node8.9

COPY package.json /superbowleto/package.json
COPY package-lock.json /superbowleto/package-lock.json
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM pagarme/docker-nodejs:8.9
FROM 697525377503.dkr.ecr.us-east-1.amazonaws.com/pay-docker-base-images:pagarme-node8.9

# Copy package definition files
COPY package.json /app/package.json
Expand All @@ -11,7 +11,7 @@ RUN apk update && \
apk add python make g++ && \
npm install --production

FROM pagarme/docker-nodejs:8.9
FROM 697525377503.dkr.ecr.us-east-1.amazonaws.com/pay-docker-base-images:pagarme-node8.9

ENV APP_NAME 'superbowleto'

Expand Down
14 changes: 1 addition & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,11 @@ services:
retries: 5

yopa:
image: pagarme/yopa:latest
command: java -Xms64m -Xmx256m -jar uberjar.jar -c /tmp/yopa-in/config.yml -o /tmp/dev-env-aws-regions-override.xml
image: 697525377503.dkr.ecr.us-east-1.amazonaws.com/pay-docker-base-images:pagarme-yopa
ports:
- 47195
volumes:
- ./yopa-config.yml:/tmp/yopa-in/config.yml:ro
healthcheck:
test: [
"CMD-SHELL",
"curl -f 'http://localhost:47195?Action=GetQueueUrl&QueueName=test'",
"&&",
"curl -f 'http://localhost:47195?Action=GetQueueUrl&QueueName=boletos-to-register'",
]
interval: 5s
retries: 5

test:
build: .
Expand All @@ -42,8 +32,6 @@ services:
depends_on:
postgres:
condition: service_healthy
yopa:
condition: service_healthy
superbowleto-web:
condition: service_started
links:
Expand Down

0 comments on commit 3cffccd

Please sign in to comment.