Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
feat: dev/stage images and upload to ecr
Browse files Browse the repository at this point in the history
  • Loading branch information
vdovhanych committed Jan 6, 2023
1 parent 0cc983d commit fa4af1f
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 10 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build-dev-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "[Build] dev user-ms image"

on:
workflow_dispatch:

jobs:
build-dev-user-ms:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
cache: "maven"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: arn:aws:iam::570620554963:role/github_actions_ecr_vexl
role-session-name: GithubActionsCloudInfrastructure
aws-region: eu-west-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build dev user-ms-ms java
run: mvn package

- name: Build and push dev user-ms image
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
push: true
build-args: |
CI_PROJECT_NAME=${{ github.repository }}
CI_COMMIT_SHORT_SHA=${{ github.sha }}
KUBE_DOMAIN=vexl.it
PROFILE=dev
tags: |
ghcr.io/${{ github.repository_owner }}/user-ms:dev
ghcr.io/${{ github.repository_owner }}/user-ms:dev-${{ github.sha }}
${{ steps.login-ecr.outputs.registry }}/user-ms:dev
${{ steps.login-ecr.outputs.registry }}/user-ms:dev-${{ github.sha }}
30 changes: 20 additions & 10 deletions .github/workflows/build-prod-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
permissions:
packages: write
contents: read
id-token: write

steps:
- name: Checkout code
Expand All @@ -20,36 +21,45 @@ jobs:
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
cache: "maven"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: arn:aws:iam::570620554963:role/github_actions_ecr_vexl
role-session-name: GithubActionsCloudInfrastructure
aws-region: eu-west-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- name: Build user-ms java
run: mvn package

- name: Build and push prod user-ms image
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
push: true
build-args: |
http_proxy=$http_proxy
https_proxy=$https_proxy
no_proxy=$no_proxy
CI_PROJECT_NAME=${{ github.repository }}
CI_COMMIT_SHORT_SHA=${{ github.sha }}
KUBE_DOMAIN=vexl.it
PROFILE=prod
tags: |
ghcr.io/${{ github.repository_owner }}/user-ms:latest
ghcr.io/${{ github.repository_owner }}/user-ms:${{ github.sha }}
${{ steps.login-ecr.outputs.registry }}/user-ms:latest
${{ steps.login-ecr.outputs.registry }}/user-ms:prod-${{ github.sha }}
62 changes: 62 additions & 0 deletions .github/workflows/build-stage-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "[Build] stage user-ms image"

on:
workflow_dispatch:

jobs:
build-stage-user-ms:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
cache: "maven"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: arn:aws:iam::570620554963:role/github_actions_ecr_vexl
role-session-name: GithubActionsCloudInfrastructure
aws-region: eu-west-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build stage user-ms-ms java
run: mvn package

- name: Build and push stage user-ms image
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
push: true
build-args: |
CI_PROJECT_NAME=${{ github.repository }}
CI_COMMIT_SHORT_SHA=${{ github.sha }}
KUBE_DOMAIN=vexl.it
PROFILE=stage
tags: |
ghcr.io/${{ github.repository_owner }}/user-ms:stage
ghcr.io/${{ github.repository_owner }}/user-ms:stage-${{ github.sha }}
${{ steps.login-ecr.outputs.registry }}/user-ms:stage
${{ steps.login-ecr.outputs.registry }}/user-ms:stage-${{ github.sha }}

0 comments on commit fa4af1f

Please sign in to comment.