[FIX] deploy

This commit is contained in:
Edouard DUPIN 2025-02-09 22:28:57 +01:00
parent c0c098d90d
commit 859011e9a6
2 changed files with 60 additions and 26 deletions

View File

@ -3,22 +3,30 @@
## buyilding-end install applications: ## buyilding-end install applications:
## ##
###################################################################################### ######################################################################################
FROM archlinux:base-devel AS builder FROM archlinux:base-devel AS common
# update system # update system
RUN pacman -Syu --noconfirm && pacman-db-upgrade \ RUN pacman -Syu --noconfirm && pacman-db-upgrade \
&& pacman -S --noconfirm jdk-openjdk maven pnpm \ && pacman -S --noconfirm jdk-openjdk \
&& pacman -Scc --noconfirm && pacman -Scc --noconfirm
ENV PATH /workspace/node_modules/.bin:$PATH WORKDIR /tmp
WORKDIR /workspace
FROM common AS builder
# update system
RUN pacman -Syu --noconfirm && pacman-db-upgrade \
&& pacman -S --noconfirm maven npm pnpm \
&& pacman -Scc --noconfirm
ENV PATH /tmp/node_modules/.bin:$PATH
###################################################################################### ######################################################################################
## ##
## Build back: ## Build back:
## ##
###################################################################################### ######################################################################################
FROM builder AS buildBack FROM builder AS build_back
COPY back/pom.xml back/Formatter.xml ./ COPY back/pom.xml ./
COPY back/Formatter.xml ./
COPY back/src ./src/ COPY back/src ./src/
RUN mvn clean compile assembly:single RUN mvn clean compile assembly:single
@ -27,27 +35,44 @@ RUN mvn clean compile assembly:single
## Build front: ## Build front:
## ##
###################################################################################### ######################################################################################
FROM builder AS buildFront FROM builder AS dependency_front
RUN echo "@kangaroo-and-rabbit:registry=https://gitea.atria-soft.org/api/packages/kangaroo-and-rabbit/npm/" > /root/.npmrc RUN echo "@kangaroo-and-rabbit:registry=https://gitea.atria-soft.org/api/packages/kangaroo-and-rabbit/npm/" > /root/.npmrc
ADD front/package.json \ ADD front/package.json \
front/karma.conf.js \ front/pnpm-lock.yaml \
front/protractor.conf.js \
./ ./
ADD front/src/theme ./src/theme
# install and cache app dependencies # install and cache app dependencies
RUN pnpm install RUN pnpm install --prod=false
ADD front/e2e \ ###############################################################
front/tsconfig.json \ ## Install sources
front/tslint.json \ ###############################################################
front/angular.json \ FROM dependency_front AS load_sources_front
./
ADD front/src ./src
# generate build # JUST to get the vertion of the application and his sha...
RUN ng build --output-path=dist --configuration=production --base-href=/karso/ --deploy-url=/karso/ karso COPY front/build.js \
front/version.txt \
front/tsconfig.json \
front/tsconfig.node.json \
front/vite.config.mts \
front/index.html \
./
COPY front/public ./public
COPY front/src ./src
#We are not in prod mode ==> we need to overwrite the production env.
ARG env=front/.env.production
COPY ${env} .env
###############################################################
## Build the sources
###############################################################
FROM load_sources_front AS build_front
# build in bundle mode all the application
RUN pnpm static:build
###################################################################################### ######################################################################################
## ##
@ -55,19 +80,28 @@ RUN ng build --output-path=dist --configuration=production --base-href=/karso/ -
## ##
###################################################################################### ######################################################################################
FROM bellsoft/liberica-openjdk-alpine:latest #FROM bellsoft/liberica-openjdk-alpine:latest
# add wget to manage the health check... ## add wget to manage the health check...
RUN apk add --no-cache wget #RUN apk add --no-cache wget
FROM common
ENV LANG=C.UTF-8 #FROM archlinux:base
#RUN pacman -Syu --noconfirm && pacman-db-upgrade
## install package
#RUN pacman -S --noconfirm jdk-openjdk wget
## intall npm
#RUN pacman -S --noconfirm npm
## clean all the caches Need only on the release environment
#RUN pacman -Scc --noconfirm
COPY --from=buildBack /workspace/out/maven/*.jar /application/application.jar ENV LANG C.UTF-8
COPY --from=buildFront /workspace/dist /application/front/
COPY --from=build_back /tmp/out/maven/*.jar /application/application.jar
COPY --from=build_front /tmp/dist /application/front/
WORKDIR /application/ WORKDIR /application/
EXPOSE 80 EXPOSE 80
# To verify health-check: docker inspect --format "{{json .State.Health }}" YOUR_SERVICE_NAME | jq # 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 \ 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 wget --no-verbose --tries=1 --spider http://localhost:80/karso/api/health_check || exit 1

View File

@ -20,7 +20,7 @@
<dependency> <dependency>
<groupId>kangaroo-and-rabbit</groupId> <groupId>kangaroo-and-rabbit</groupId>
<artifactId>archidata</artifactId> <artifactId>archidata</artifactId>
<version>0.23.4</version> <version>0.23.6</version>
</dependency> </dependency>
<!-- Loopback of logger JDK logging API to SLF4J --> <!-- Loopback of logger JDK logging API to SLF4J -->
<dependency> <dependency>