Skip to content

Commit

Permalink
#388 introduce multiarch images (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
lojzatran authored Aug 12, 2022
1 parent 5259f14 commit f058822
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 43 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,22 @@ jobs:
with:
java-version: 11
distribution: 'zulu'
- name: Build and push image to docker using gradle plugin
run: ./gradlew setLibraryVersion dockerPushImage -Dbuild.version=${{ steps.vars.outputs.tag }} --daemon
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Build java classes
run: ./gradlew setLibraryVersion assemble
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push project sync
id: docker_build_extension
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: commercetools/commercetools-project-sync:${{ steps.vars.outputs.tag }}
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM adoptopenjdk/openjdk11:jre
LABEL maintainer="PS Team Munich [[email protected]]"
WORKDIR /app
COPY ./build/libs libs/
COPY ./build/resources resources/
COPY ./build/classes classes/
ENTRYPOINT ["java", "-cp", "/app/resources:/app/classes:/app/libs/*", "com.commercetools.project.sync.SyncerApplication"]
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Example:
##### Download

```bash
docker pull commercetools/commercetools-project-sync:5.1.3
docker pull commercetools/commercetools-project-sync:5.2.0
```
##### Run

Expand All @@ -215,14 +215,14 @@ docker run \
-e TARGET_PROJECT_KEY=xxxx \
-e TARGET_CLIENT_ID=xxxx \
-e TARGET_CLIENT_SECRET=xxxx \
commercetools/commercetools-project-sync:5.1.3 -s all
commercetools/commercetools-project-sync:5.2.0 -s all
```


### Examples
- To run the all sync modules from a source project to a target project
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s all
docker run commercetools/commercetools-project-sync:5.2.0 -s all
```
This will run the following sync modules in the given order:
1. `Type` Sync and `ProductType` Sync and `States` Sync and `TaxCategory` Sync and `CustomObject` Sync in parallel.
Expand All @@ -232,68 +232,68 @@ commercetools/commercetools-project-sync:5.1.3 -s all

- To run the type sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s types
docker run commercetools/commercetools-project-sync:5.2.0 -s types
```

- To run the productType sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s productTypes
docker run commercetools/commercetools-project-sync:5.2.0 -s productTypes
```

- To run the states sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s states
docker run commercetools/commercetools-project-sync:5.2.0 -s states
```
- To run the taxCategory sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s taxCategories
docker run commercetools/commercetools-project-sync:5.2.0 -s taxCategories
```

- To run the category sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s categories
docker run commercetools/commercetools-project-sync:5.2.0 -s categories
```

- To run the product sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s products
docker run commercetools/commercetools-project-sync:5.2.0 -s products
```

- To run the cartDiscount sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s cartDiscounts
docker run commercetools/commercetools-project-sync:5.2.0 -s cartDiscounts
```

- To run the inventoryEntry sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s inventoryEntries
docker run commercetools/commercetools-project-sync:5.2.0 -s inventoryEntries
```

- To run the customObject sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s customObjects
docker run commercetools/commercetools-project-sync:5.2.0 -s customObjects
```

- To run the customer sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s customers
docker run commercetools/commercetools-project-sync:5.2.0 -s customers
```

- To run the shoppingList sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s shoppingLists
docker run commercetools/commercetools-project-sync:5.2.0 -s shoppingLists
```
- To run both products and shoppingList sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s products shoppingLists
docker run commercetools/commercetools-project-sync:5.2.0 -s products shoppingLists
```

- To run type, productType and shoppingList sync
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s types productTypes shoppingLists
docker run commercetools/commercetools-project-sync:5.2.0 -s types productTypes shoppingLists
```

- To run all sync modules using a runner name
```bash
docker run commercetools/commercetools-project-sync:5.1.3 -s all -r myRunnerName
docker run commercetools/commercetools-project-sync:5.2.0 -s all -r myRunnerName
```
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ plugins {
id "com.github.ben-manes.versions" version '0.42.0'
id 'com.adarshr.test-logger' version '3.2.0'
id 'com.diffplug.spotless' version '6.9.0'
id 'com.bmuschko.docker-java-application' version '7.4.0'
id "com.github.spotbugs" version "5.0.9"
}

Expand Down Expand Up @@ -48,7 +47,6 @@ apply from: "$rootDir/gradle-scripts/pmd.gradle"
apply from: "$rootDir/gradle-scripts/jacoco.gradle"
apply from: "$rootDir/gradle-scripts/spotbugs.gradle"
apply from: "$rootDir/gradle-scripts/shadow.gradle"
apply from: "$rootDir/gradle-scripts/docker.gradle"
apply from: "$rootDir/gradle-scripts/execution-order.gradle"

/**
Expand Down
17 changes: 11 additions & 6 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,18 @@ It is recommended to set it in your IDE auto formatting settings for this projec
./gradlew clean build
````

### Build
### Build a docker image

To build a docker image, you need to install docker. [Dockerfile](../Dockerfile) is provided in the root folder.
Before building a docker image, you need to compile java classes:
```bash
./gradlew setLibraryVersion assemble
```
Then you can build the docker image with the following command:
```bash
docker buildx build --tag commercetools/commercetools-project-sync:<version> . --load
```

Gradle docker plugin is used to build and deploy the docker images.
To build the docker image locally, please run
````bash
./gradlew dockerBuildImage
````
The docker image has been built and published to your desktop docker.

Example:
Expand Down
13 changes: 0 additions & 13 deletions gradle-scripts/docker.gradle

This file was deleted.

0 comments on commit f058822

Please sign in to comment.