Update dockerfile with curl instead of wget #98
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Backend CD | |
on: | |
push: | |
branches: | |
- "main" | |
- "staging" | |
- "production" | |
- "perf" | |
jobs: | |
build_and_push_docker_image: | |
name: Build and push docker image to AWS ECR | |
runs-on: ubuntu-latest | |
environment: ${{ github.ref_name == 'main' && 'develop' || github.ref_name }} | |
concurrency: | |
group: ${{ github.ref_name }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref_name }} | |
- name: Java setup | |
uses: ./.github/actions/java-setup | |
with: | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Maven build | |
run: ./mvnw clean install -T 4 -DskipTests -DskipITs -DskipUTs | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ${{ vars.AWS_REGION }} | |
role-to-assume: ${{ vars.AWS_ROLE }} | |
- name: Retrieve parameters | |
env: | |
REPO_NAME: ${{ github.event.repository.name }} | |
run: | | |
echo SHA_SHORT=$(git rev-parse --short HEAD) >> "$GITHUB_ENV" | |
echo ECR_REPOSITORY_URI=$(aws ecr describe-repositories --query "repositories[?contains(@.repositoryName, 'marketplacerepository') == \`true\`].repositoryUri" --output text) >> "$GITHUB_ENV" | |
echo CLUSTER_ARN=$(aws ecs list-clusters --query 'clusterArns[0]' --output text) >> "$GITHUB_ENV" | |
echo SERVICES=$(aws resourcegroupstaggingapi get-resources --tag-filters Key=repo,Values="$REPO_NAME" --resource-type-filters ecs:service --query 'ResourceTagMappingList[*].ResourceARN' --output text ) >> "$GITHUB_ENV" | |
- name: Login to ECR | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.ECR_REPOSITORY_URI }} | |
- name: Build, tag, and push image to Amazon ECR | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: . | |
tags: | | |
${{ env.ECR_REPOSITORY_URI }}:latest | |
${{ env.ECR_REPOSITORY_URI }}:${{ env.SHA_SHORT }} | |
- name: Deploy ECR services | |
run: | | |
for service in ${{ env.SERVICES }}; do | |
aws ecs update-service --cluster ${{ env.CLUSTER_ARN }} --service $service --force-new-deployment | |
done |