diff --git a/docker/build-docker-image.sh b/docker/build-docker-image.sh new file mode 100755 index 000000000..19a3b86ff --- /dev/null +++ b/docker/build-docker-image.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Copyright 2017-2022 Adobe. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +BUILDER_NAME=$1 +TAG_NAME=$2 + +docker buildx build --load --tag "${TAG_NAME}" --builder "${BUILDER_NAME}" . diff --git a/docker/pom.xml b/docker/pom.xml index 6481ec49a..b0e8c5d80 100644 --- a/docker/pom.xml +++ b/docker/pom.xml @@ -110,17 +110,67 @@ - io.fabric8 - docker-maven-plugin + org.codehaus.mojo + exec-maven-plugin + + start-buildkit + prepare-package + + exec + + + sh + + start-buildkit.sh + ${docker-builder.image.name} + + + build-docker-image package - build + exec + + sh + + build-docker-image.sh + ${docker-builder.image.name} + ${docker.image.name}:${project.version} + + + + + stop-builder-container + deploy + + exec + + + docker + + buildx + rm + ${docker-builder.image.name} + + + + true + false + + + + com.adobe.testing + s3mock + exec + ${project.version} + jar + + @@ -133,15 +183,26 @@ - io.fabric8 - docker-maven-plugin + org.codehaus.mojo + exec-maven-plugin - tag-docker-image-commit-id - install + push-docker-image + package - push + exec + + sh + + push-docker-image.sh + ${docker-builder.image.name} + + ${docker.image.name}:${project.version} + + ${docker.image.name}:latest + + diff --git a/docker/push-docker-image.sh b/docker/push-docker-image.sh new file mode 100755 index 000000000..16a7fb293 --- /dev/null +++ b/docker/push-docker-image.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Copyright 2017-2022 Adobe. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +BUILDER_NAME=$1 +VERSIONED_TAG_NAME=$2 +LATEST_TAG_NAME=$3 + +docker buildx build --platform linux/amd64,linux/arm64 --push --tag "${VERSIONED_TAG_NAME}" --tag "${LATEST_TAG_NAME}" --builder "${BUILDER_NAME}" . diff --git a/docker/start-buildkit.sh b/docker/start-buildkit.sh new file mode 100755 index 000000000..2e774159e --- /dev/null +++ b/docker/start-buildkit.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Copyright 2017-2022 Adobe. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +BUILDER_NAME=$1 + +if [ "$(docker buildx ls | grep ${BUILDER_NAME} | wc -l)" -eq 0 ]; then \ + docker buildx create --driver docker-container --name "${BUILDER_NAME}" ; \ + docker buildx inspect --bootstrap --builder "${BUILDER_NAME}" ; \ +fi diff --git a/pom.xml b/pom.xml index 3773cb693..02df45c6e 100644 --- a/pom.xml +++ b/pom.xml @@ -51,6 +51,7 @@ 8 adobe/s3mock + s3mock-buildx false @@ -202,6 +203,11 @@ + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + maven-enforcer-plugin ${maven-enforcer-plugin.version}