From ab949c108474461497ae7cf13fd4ec0354b2917e Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 14 May 2024 09:05:07 +0200 Subject: [PATCH] [CI] correct the build --- Dockerfile | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5309053..c093f6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,11 +6,11 @@ FROM archlinux:base-devel AS builder # update system RUN pacman -Syu --noconfirm && pacman-db-upgrade \ - && pacman -S --noconfirm jdk-openjdk maven npm \ + && pacman -S --noconfirm jdk-openjdk maven pnpm \ && pacman -Scc --noconfirm -ENV PATH /tmp/node_modules/.bin:$PATH -WORKDIR /tmp +ENV PATH /workspace/node_modules/.bin:$PATH +WORKDIR /workspace ###################################################################################### ## @@ -18,8 +18,8 @@ WORKDIR /tmp ## ###################################################################################### FROM builder AS buildBack -COPY back/pom.xml /tmp -COPY back/src /tmp/src/ +COPY back/pom.xml back/Formatter.xml ./ +COPY back/src ./src/ RUN mvn clean compile assembly:single ###################################################################################### @@ -29,21 +29,22 @@ RUN mvn clean compile assembly:single ###################################################################################### FROM builder AS buildFront -ADD front/package-lock.json \ - front/package.json \ +RUN echo "@kangaroo-and-rabbit:registry=https://gitea.atria-soft.org/api/packages/kangaroo-and-rabbit/npm/" > /root/.npmrc + +ADD front/package.json \ front/karma.conf.js \ front/protractor.conf.js \ - /tmp/ + ./ # install and cache app dependencies -RUN npm install +RUN pnpm install ADD front/e2e \ front/tsconfig.json \ front/tslint.json \ front/angular.json \ - /tmp/ -ADD front/src /tmp/src + ./ +ADD front/src ./src # generate build RUN ng build --output-path=dist --configuration=production --base-href=/karso/ --deploy-url=/karso/ karso @@ -60,11 +61,15 @@ RUN apk add --no-cache wget ENV LANG=C.UTF-8 -COPY --from=buildBack /tmp/out/maven/*.jar /application/application.jar -COPY --from=buildFront /tmp/dist /application/front/ +COPY --from=buildBack /workspace/out/maven/*.jar /application/application.jar +COPY --from=buildFront /workspace/dist /application/front/ WORKDIR /application/ EXPOSE 80 +# To verify health-check: docker inspect --format "{{json .State.Health }}" YOUR_SERVICE_NAME | jq +HEALTHCHECK --start-period=30s --start-interval=5s --interval=30s --timeout=5s --retries=10 \ + CMD wget --no-verbose --tries=1 --spider http://localhost:80/karso/api/health_check || exit 1 + CMD ["java", "-Xms64M", "-Xmx1G", "-cp", "/application/application.jar", "org.kar.karso.WebLauncher"]