Difference between revisions of "My-docker-publish.yml"
Jump to navigation
Jump to search
Line 88: | Line 88: | ||
run: | | run: | | ||
aws ecs update-service --cluster your-cluster-name --service your-service [[--force-new-deployment]] | aws ecs update-service --cluster your-cluster-name --service your-service [[--force-new-deployment]] | ||
+ | |||
+ | |||
+ | == Related == | ||
+ | * [[docker-publish.ym]] | ||
+ | |||
+ | |||
+ | {{GitHub Actions}} |
Revision as of 22:56, 14 May 2023
name: Build & deploy xxxxx container to stage env on: workflow_dispatch env: ACTIONS_RUNNER_DEBUG: true #AWS_REGION: MY_AWS_REGION ECR_REPOSITORY: your-repo ECR_REGISTRY: 12312432424234.dkr.ecr.eu-west-1.amazonaws.com #ECS_SERVICE: MY_ECS_SERVICE #ECS_CLUSTER: MY_ECS_CLUSTER #ECS_TASK_DEFINITION: MY_ECS_TASK_DEFINITION CONTAINER_NAME: your-container-name jobs: build-docker-image: runs-on: self-hosted environment: build permissions: id-token: write contents: read steps: - name: Checkout uses: actions/checkout@v3
- name: Configure AWS Credentials uses: actions/configure-aws-credentials@v2.0.0 with: aws-region: eu-west-1
- name: Login to Private ECR id: login-private-ecr uses: actions/amazon-ecr-login@v2.0.0 - name: Build, tag, and push image to Amazon ECR id: build-image env: #ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} #IMAGE_TAG: ${{ github.sha }} IMAGE_TAG: latest working-directory: ./your-working-dir run: | # Build a docker container and # push it to ECR so that it can # be deployed to ECS.
echo "DEBUG: $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . echo "============ BEGIN DEBUG ================" aws ecr describe-repositories | grep repositoryName echo "============ END DEBUG ================" docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT deploy-docker-image: runs-on: self-hosted environment: deploy needs: build-docker-image permissions: id-token: write contents: read
steps: - name: Checkout uses: actions/checkout@v3
- name: Configure AWS Credentials uses: actions/[email protected] with: aws-region: eu-west-1
- name: Login to Private ECR id: login-private-ecr uses: actions/[email protected] - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.STAGING_DEPLOY_ACCESS_KEY }} aws-secret-access-key: ${{ secrets.STAGING_DEPLOY_ACCESS_SECRET }} aws-region: eu-west-1
- name: Force ECS deployment run: | aws ecs update-service --cluster your-cluster-name --service your-service --force-new-deployment
Related
GitHub Actions, act, .github/workflows/
, ~/actions-runner/
, svc.sh
, deploy:, run:, runs-on:
, uses:
, steps:
, jobs:
, on:, env:, uses:, script:, continue-on-error:, template:, aws-actions, inputs:
, GITHUB_ENV, needs:, github.
, GitHub runner, my-docker-publish.yml, GitHub Actions variables, GitHub Actions contexts, GitHub Actions Importer, If:, SLSA, Actions Runner Controller (ARC), $GITHUB OUTPUT
, notify:
, Marketplace, GITHUB_TOKEN
Advertising: