Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
ci: create CI to build docker image and push to ECR#3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| * @aeneasr @ory/product-development | ||
| * @SPHTech/identity-platform-team |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,60 +1,31 @@ | ||
| <!-- | ||
| Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. | ||
| This text will be included in the changelog. If applicable, include links to documentation or pieces of code. | ||
| If your change includes breaking changes please add a code block documenting the breaking change: | ||
| ``` | ||
| BREAKING CHANGES: This patch changes the behavior of configuration item `foo` to do bar. To keep the existing | ||
| behavior please do baz. | ||
| ``` | ||
| --> | ||
| ## Related issue(s) | ||
| <!-- | ||
| If this pull request | ||
| 1. is a fix for a known bug, link the issue where the bug was reported in the format of `#1234`; | ||
| 2. is a fix for a previously unknown bug, explain the bug and how to reproduce it in this pull request; | ||
| 3. implements a new feature, link the issue containing the design document in the format of `#1234`; | ||
| 4. improves the documentation, no issue reference is required. | ||
| Pull requests introducing new features, which do not have a design document linked are more likely to be rejected and take on average 2-8 weeks longer to | ||
| get merged. | ||
| You can discuss changes with maintainers either in the Github Discussions in this repository or | ||
| join the [Ory Chat](https://www.ory.sh/chat). | ||
| --> | ||
| ## Checklist | ||
| <!-- | ||
| Put an `x` in the boxes that apply. You can also fill these out after creating the PR. | ||
| Please be aware that pull requests must have all boxes ticked in order to be merged. | ||
| If you're unsure about any of them, don't hesitate to ask. We're here to help! | ||
| --> | ||
| - [ ] I have read the [contributing guidelines](../blob/master/CONTRIBUTING.md). | ||
| - [ ] I have referenced an issue containing the design document if my change | ||
| introduces a new feature. | ||
| - [ ] I am following the | ||
| [contributing code guidelines](../blob/master/CONTRIBUTING.md#contributing-code). | ||
| - [ ] I have read the [security policy](../security/policy). | ||
| - [ ] I confirm that this pull request does not address a security | ||
| vulnerability. If this pull request addresses a security vulnerability, I | ||
| confirm that I got the approval (please contact | ||
| [security@ory.sh](mailto:security@ory.sh)) from the maintainers to push | ||
| the changes. | ||
| - [ ] I have added tests that prove my fix is effective or that my feature | ||
| works. | ||
| - [ ] I have added or changed [the documentation](https://github.com/ory/docs). | ||
| ## Further Comments | ||
| <!-- | ||
| If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution | ||
| you did and what alternatives you considered, etc... | ||
| --> | ||
| ## Contents | ||
| 1. [Summary](#summary) | ||
| 2. [Links](#links) | ||
| 3. [Test Plan](#test-plan) | ||
| ## Summary | ||
| // What changes are made / introduced in this PR? | ||
| ### Problem | ||
| // Give a TL;DR, one sentence summary on the feature, issue, bug to resolve. | ||
| ### Solution | ||
| // Give detailed explanation on the solution. What is the fix? Why do we need to do it this way? How does it resolve the error? | ||
| ## Links | ||
| // JIRA card link, any published API docs, confluence etc. | ||
| ## Test Plan | ||
| // How did you test your code? | ||
| // If you can't test this locally, describe how you will test it after the PR is merged | ||
| // Add details about how you setup your test (if any), and screenshots of the test results whenever possible | ||
| ### Test Method | ||
| ### Test Results |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| name: Build and Push Image to ECR | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| commit_sha: | ||
| description: "Commit SHA to build" | ||
| required: true | ||
| environment: | ||
| description: "Environment to build" | ||
| required: true | ||
| permissions: | ||
| id-token: write | ||
| jobs: | ||
| prepare: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| short_sha: ${{ steps.get-short-sha.outputs.short_sha }} | ||
| steps: | ||
| - name: Compute short SHA | ||
| id: get-short-sha | ||
| env: | ||
| FULL_SHA: ${{ github.event.inputs.commit_sha || 'master' }} | ||
| run: | | ||
| echo "short_sha=${FULL_SHA::7}" >> "$GITHUB_OUTPUT" | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| needs: prepare | ||
| environment: ${{ github.event.inputs.environment || 'dev'}} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.inputs.commit_sha || 'master' }} | ||
| path: . | ||
| - name: Setup Go environment | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: "./go.mod" | ||
| - run: go version | ||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ vars.AWS_IAM_ROLE }} | ||
| role-skip-session-tagging: true | ||
| role-session-name: gh-actions | ||
| aws-region: ${{ vars.AWS_REGION }} | ||
| - name: Login to Amazon ECR | ||
| id: login-ecr | ||
| uses: aws-actions/amazon-ecr-login@v2 | ||
Uh oh!There was an error while loading. Please reload this page. | ||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
Uh oh!There was an error while loading. Please reload this page. | ||
| - name: Setup docker buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
Uh oh!There was an error while loading. Please reload this page. | ||
| with: | ||
| version: latest | ||
| - name: Build kratos binary | ||
| run: | | ||
| GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o kratos . | ||
| - name: Get Image name:tag | ||
| id: get-image-name | ||
| run: | | ||
| echo "image_name=${{ steps.login-ecr.outputs.registry }}/idpf/kratos:${{ needs.prepare.outputs.short_sha }}" >> "$GITHUB_OUTPUT" | ||
| - name: Build Docker Image | ||
| run: | | ||
| docker build -f .docker/Dockerfile-alpine -t ${{ steps.get-image-name.outputs.image_name }} . | ||
| - name: Push Docker Image | ||
| run: | | ||
| docker push ${{ steps.get-image-name.outputs.image_name }} | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.