Skip to content

Commit

Permalink
Deploy stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ia3andy committed Dec 22, 2023
1 parent 04b40ae commit f91779d
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 13 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*
!src
!mvnw
!.mvn
!pom.xml
!base/*
!community-app/*
!acceptance-test/*
10 changes: 10 additions & 0 deletions deploy/build_deploy.sh
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions deploy/build_deploy_acceptance_test.sh
Original file line number Diff line number Diff line change
@@ -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

3 changes: 2 additions & 1 deletion build_deploy.sh → deploy/build_deploy_community_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
File renamed without changes.
22 changes: 17 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
<quarkus-web-bundler.version>1.2.0.CR1</quarkus-web-bundler.version>
<quarkus-playwright.version>0.0.1</quarkus-playwright.version>
</properties>
<modules>
<module>base/.locker</module>
<module>base</module>
<module>community-app</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -89,6 +84,23 @@
</plugins>
</build>
<profiles>
<profile>
<id>app</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>base/.locker</module>
<module>base</module>
<module>community-app</module>
</modules>
</profile>
<profile>
<id>acceptance-test</id>
<modules>
<module>acceptance-test</module>
</modules>
</profile>
<profile>
<id>native</id>
<activation>
Expand Down

0 comments on commit f91779d

Please sign in to comment.