From efe05733f22c4b1013bd3d7fd8970312a182289e Mon Sep 17 00:00:00 2001 From: Viren Baraiya Date: Fri, 29 Sep 2023 13:33:27 -0700 Subject: [PATCH] update docker builds (#40) --- docker/DockerfileServer | 35 +++++++++++++++++++++++++++++++++-- docker/DockerfileStandalone | 36 +++++++++++++++++++++++++++++++++--- run_tests.sh | 13 +++++++++---- 3 files changed, 75 insertions(+), 9 deletions(-) diff --git a/docker/DockerfileServer b/docker/DockerfileServer index 23e104b..2fd9ec0 100644 --- a/docker/DockerfileServer +++ b/docker/DockerfileServer @@ -1,3 +1,34 @@ +# +# conductor:server - Combined Netflix conductor server & UI +# +# =========================================================================================================== +# 0. Builder stage +# =========================================================================================================== +FROM alpine:3.18 AS builder + +MAINTAINER Orkes Inc + +# =========================================================================================================== +# 0. Build Conductor Server UI +# =========================================================================================================== + + +# Install dependencies +RUN apk add openjdk17 +RUN apk add git +RUN apk add --update nodejs npm yarn + +COPY . /conductor-community +WORKDIR conductor-community +RUN ./gradlew clean build -x test + +WORKDIR / +RUN git clone https://github.com/Netflix/conductor +WORKDIR conductor/ui +RUN yarn install && yarn build +RUN ls -ltr +RUN echo "Done building UI" + FROM alpine:3.18.3 MAINTAINER Orkes Inc @@ -16,7 +47,7 @@ RUN mkdir -p /app/config /app/logs /app/libs /app/info # Make sure to run build-ui.sh script before running the docker build to pull and build the UI WORKDIR /usr/share/nginx/html RUN rm -rf ./* -COPY docker/tmp/ui/conductor/ui/build . +COPY --from=builder /conductor/ui/build . COPY docker/config/nginx.conf /etc/nginx/http.d/default.conf # Startup script(s) @@ -25,7 +56,7 @@ COPY docker/config/config.properties /app/config/config.properties COPY server/src/main/resources/banner.txt /app/config/banner.txt # JAR files -COPY server/build/libs/orkes-conductor-server-boot.jar /app/libs/server.jar +COPY --from=builder conductor-community/server/build/libs/orkes-conductor-server-boot.jar /app/libs/server.jar # Server version #COPY assembled/libs/server-version.txt* /app/info diff --git a/docker/DockerfileStandalone b/docker/DockerfileStandalone index 2a756b1..af8fa0b 100644 --- a/docker/DockerfileStandalone +++ b/docker/DockerfileStandalone @@ -1,3 +1,34 @@ +# +# conductor:server - Combined Netflix conductor server & UI +# +# =========================================================================================================== +# 0. Builder stage +# =========================================================================================================== +FROM alpine:3.18 AS builder + +MAINTAINER Orkes Inc + +# =========================================================================================================== +# 0. Build Conductor Server UI +# =========================================================================================================== + + +# Install dependencies +RUN apk add openjdk17 +RUN apk add git +RUN apk add --update nodejs npm yarn + +COPY . /conductor-community +WORKDIR conductor-community +RUN ./gradlew clean build -x test + +WORKDIR / +RUN git clone https://github.com/Netflix/conductor +WORKDIR conductor/ui +RUN yarn install && yarn build +RUN ls -ltr +RUN echo "Done building UI" + FROM alpine:3.18.3 MAINTAINER Orkes Inc @@ -15,10 +46,9 @@ RUN mkdir -p /app/config /app/logs /app/libs /app/info # Make sure to run build-ui.sh script before running the docker build to pull and build the UI WORKDIR /usr/share/nginx/html RUN rm -rf ./* -COPY docker/tmp/ui/conductor/ui/build . +COPY --from=builder /conductor/ui/build . COPY docker/config/nginx.conf /etc/nginx/http.d/default.conf - # Startup script(s) COPY docker/config/startup.sh /app/startup.sh COPY docker/config/config.properties /app/config/config.properties @@ -27,7 +57,7 @@ COPY docker/config/start_all.sh /app/start_all.sh COPY server/src/main/resources/banner.txt /app/config/banner.txt # JAR files -COPY server/build/libs/orkes-conductor-server-boot.jar /app/libs/server.jar +COPY --from=builder conductor-community/server/build/libs/orkes-conductor-server-boot.jar /app/libs/server.jar RUN chmod +x /app/startup.sh RUN touch /app/logs/server.log diff --git a/run_tests.sh b/run_tests.sh index 150bf69..72ad715 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,13 +1,18 @@ -./gradlew clean build -# Create an empty ui build directory... we don't need UI for this build -mkdir -p docker/tmp/ui/conductor/ui/build docker rm -f conductor_test_container docker build -f docker/DockerfileStandalone . -t conductor_test_container docker run -dit --name conductor_test_container -p 8899:8080 -p 4535:5000 -t conductor_test_container +COUNTER=0 +MAX_TIME=120 while ! curl -s http://localhost:8899/api/metadata/workflow -o /dev/null do - echo "$(date) - still trying" + echo "$(date) - still trying - since $COUNTER second, will wait for $MAX_TIME" sleep 1 + let COUNTER=COUNTER+1 + if [ $COUNTER -gt $MAX_TIME ]; + then + echo "Exceeded wait time of $MAX_TIME seconds. Terminating the build" + exit 1 + fi done sleep 5 echo "All set - starting tests now"