wip: test docker image build #1
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: Build | |
on: push | |
env: | |
AWS_REGION: us-east-1 # set this to your preferred AWS region, e.g. us-west-1 | |
ECR_REPOSITORY: altinityinfra-clickhouse-sink-connector # set this to your Amazon ECR repository name | |
permissions: | |
id-token: write | |
contents: write | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: arn:aws:iam::114810186946:role/githubactions | |
role-session-name: Github | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Setup env | |
working-directory: sink-connector | |
run: echo "PROJECT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> "$GITHUB_ENV" | |
- name: Build with Maven (Kafka) | |
working-directory: sink-connector | |
run: mvn -B package install -DskipTests=true --file pom.xml | |
- name: Upload Maven build (Kafka) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: clickhouse-sink-connector-kafka-${{ env.IMAGE_TAG }}.jar | |
path: sink-connector/target/clickhouse-kafka-sink-connector-${{ env.PROJECT_VERSION }}.jar | |
- name: Update sink connector jar file version in sink-connector-lightweight pom.xml | |
working-directory: sink-connector-lightweight | |
run: mvn versions:set-property -Dproperty=sink-connector-library-version -DnewVersion=${{ env.PROJECT_VERSION }} | |
- name: Build with Maven (Lightweight) | |
working-directory: sink-connector-lightweight | |
run: mvn -B package -DskipTests=true --file pom.xml | |
- name: Upload Maven build (Lightweight) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: clickhouse-sink-connector-lt-${{ env.IMAGE_TAG }}.jar | |
path: sink-connector-lightweight/target/clickhouse-debezium-embedded-${{ env.PROJECT_VERSION }}.jar | |
- name: Build with Go | |
working-directory: sink-connector-client | |
run: CGO_ENABLED=0 go build | |
- name: Build, tag, and push image to Amazon ECR | |
id: build-image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
IMAGE_TAG: 408-97b1d3d83ef93c1b76a2b1c4d9c544dc67fbbec3-lt | |
run: | | |
docker build --platform=linux/amd64 . --file sink-connector-lightweight/Dockerfile --tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
docker save $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | gzip > clickhouse-sink-connector_$IMAGE_TAG.tar.gz | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG |