diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..1d5d5a25c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +* +!src +!mvnw +!.mvn +!pom.xml +!base/* +!community-app/* +!acceptance-test/* \ No newline at end of file diff --git a/deploy/build_deploy.sh b/deploy/build_deploy.sh new file mode 100755 index 000000000..d9101361b --- /dev/null +++ b/deploy/build_deploy.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -exv + +if [[ $(git --no-pager log --oneline -1) == *Bump* ]]; then + exit 1 +fi +cd ..; +./deploy/build_deploy_community-app.sh +./deploy./build_deploy_acceptance_test.sh diff --git a/deploy/build_deploy_acceptance_test.sh b/deploy/build_deploy_acceptance_test.sh new file mode 100755 index 000000000..f2dd9a604 --- /dev/null +++ b/deploy/build_deploy_acceptance_test.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -exv + +GIT_REV=$(git rev-parse HEAD) +GIT_REV_SHORT=$(git rev-parse --short=7 HEAD) +IMAGE=${IMAGE-"quay.io/quarkus/code-quarkus-acceptance-test"} +IMAGE_TAG=${IMAGE_TAG-$GIT_REV_SHORT} + +docker build --compress -f docker/Dockerfile.acceptance-test.multistage --build-arg MAVEN_BUILD_EXTRA_ARGS="-Dgit.commit.id=$GIT_REV" -t "${IMAGE}:${IMAGE_TAG}" . + +if [[ -n "$QUAY_USER" && -n "$QUAY_TOKEN" ]]; then + DOCKER_CONF="$PWD/.docker" + mkdir -p "$DOCKER_CONF" + docker tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:latest" + echo "$QUAY_TOKEN" | docker --config="$DOCKER_CONF" login -u="$QUAY_USER" --password-stdin quay.io + docker --config="$DOCKER_CONF" push "${IMAGE}:${IMAGE_TAG}" + docker --config="$DOCKER_CONF" push "${IMAGE}:latest" +fi + diff --git a/build_deploy.sh b/deploy/build_deploy_community_app.sh similarity index 78% rename from build_deploy.sh rename to deploy/build_deploy_community_app.sh index 970b224c3..8f7aebfd9 100755 --- a/build_deploy.sh +++ b/deploy/build_deploy_community_app.sh @@ -7,7 +7,7 @@ GIT_REV_SHORT=$(git rev-parse --short=7 HEAD) IMAGE=${IMAGE-"quay.io/quarkus/code-quarkus-app"} IMAGE_TAG=${IMAGE_TAG-$GIT_REV_SHORT} -docker build --compress -f src/main/docker/Dockerfile.multistage --build-arg MAVEN_BUILD_EXTRA_ARGS="-Dgit.commit.id=$GIT_REV" -t "${IMAGE}:${IMAGE_TAG}" . +docker build --compress -f docker/Dockerfile.community.multistage --build-arg MAVEN_BUILD_EXTRA_ARGS="-Dgit.commit.id=$GIT_REV" -t "${IMAGE}:${IMAGE_TAG}" . if [[ -n "$QUAY_USER" && -n "$QUAY_TOKEN" ]]; then DOCKER_CONF="$PWD/.docker" @@ -17,3 +17,4 @@ if [[ -n "$QUAY_USER" && -n "$QUAY_TOKEN" ]]; then docker --config="$DOCKER_CONF" push "${IMAGE}:${IMAGE_TAG}" docker --config="$DOCKER_CONF" push "${IMAGE}:latest" fi + diff --git a/openshift/code-quarkus-acceptance-test.yaml b/deploy/openshift/code-quarkus-acceptance-test.yaml similarity index 100% rename from openshift/code-quarkus-acceptance-test.yaml rename to deploy/openshift/code-quarkus-acceptance-test.yaml diff --git a/openshift/code-quarkus.yaml b/deploy/openshift/code-quarkus.yaml similarity index 100% rename from openshift/code-quarkus.yaml rename to deploy/openshift/code-quarkus.yaml diff --git a/openshift/deploy.sh b/deploy/openshift/deploy.sh similarity index 100% rename from openshift/deploy.sh rename to deploy/openshift/deploy.sh diff --git a/acceptance-test/src/main/docker/Dockerfile.multistage b/docker/Dockerfile.acceptance-test.multistage similarity index 63% rename from acceptance-test/src/main/docker/Dockerfile.multistage rename to docker/Dockerfile.acceptance-test.multistage index e59557869..5176c1572 100644 --- a/acceptance-test/src/main/docker/Dockerfile.multistage +++ b/docker/Dockerfile.acceptance-test.multistage @@ -2,14 +2,17 @@ FROM registry.access.redhat.com/ubi8/openjdk-17:1.18 AS build ARG MAVEN_BUILD_EXTRA_ARGS= RUN echo "$MAVEN_BUILD_EXTRA_ARGS" -COPY pom.xml mvnw /usr/src/app/ + +COPY mvnw pom.xml maven-settings.xml* /usr/src/app/ +COPY acceptance-test/pom.xml /usr/src/app/acceptance-test/ COPY .mvn /usr/src/app/.mvn + RUN cd /usr/src/app/ && ./mvnw verify clean --fail-never -COPY src /usr/src/app/src +COPY acceptance-test/src /usr/src/app/acceptance-test/src USER root RUN chown -R 185 /usr/src/app USER 185 -RUN cd /usr/src/app/ && ./mvnw clean package -DskipTests $MAVEN_BUILD_EXTRA_ARGS +RUN cd /usr/src/app/ && ./mvnw clean package -Pacceptance-test -P\!app -DskipTests $MAVEN_BUILD_EXTRA_ARGS ## Stage 2 : create the docker final image FROM mcr.microsoft.com/playwright:v1.40.1-jammy @@ -28,10 +31,10 @@ RUN apt-get update \ && chmod "g+rwX" /.cache # We make four distinct layers so if there are application changes the library layers can be re-used -COPY --from=build --chown=185 usr/src/app/target/quarkus-app/lib/ /deployments/lib/ -COPY --from=build --chown=185 usr/src/app/target/quarkus-app/app/ /deployments/app/ -COPY --from=build --chown=185 usr/src/app/target/quarkus-app/*.jar /deployments/ -COPY --from=build --chown=185 usr/src/app/target/quarkus-app/quarkus/ /deployments/quarkus/ +COPY --from=build --chown=185 usr/src/app/acceptance-test/target/quarkus-app/lib/ /deployments/lib/ +COPY --from=build --chown=185 usr/src/app/acceptance-test/target/quarkus-app/app/ /deployments/app/ +COPY --from=build --chown=185 usr/src/app/acceptance-test/target/quarkus-app/*.jar /deployments/ +COPY --from=build --chown=185 usr/src/app/acceptance-test/target/quarkus-app/quarkus/ /deployments/quarkus/ EXPOSE 8080 diff --git a/docker/Dockerfile.multistage b/docker/Dockerfile.community-app.multistage similarity index 100% rename from docker/Dockerfile.multistage rename to docker/Dockerfile.community-app.multistage diff --git a/pom.xml b/pom.xml index 431e87af9..f22967a46 100644 --- a/pom.xml +++ b/pom.xml @@ -20,11 +20,6 @@ 1.2.0.CR1 0.0.1 - - base/.locker - base - community-app - @@ -89,6 +84,23 @@ + + app + + true + + + base/.locker + base + community-app + + + + acceptance-test + + acceptance-test + + native