[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:
##
######################################################################################
FROM archlinux:base-devel AS builder
FROM archlinux:base-devel AS common
# update system
RUN pacman -Syu --noconfirm && pacman-db-upgrade \
&& pacman -S --noconfirm jdk-openjdk maven pnpm \
&& pacman -S --noconfirm jdk-openjdk \
&& pacman -Scc --noconfirm
ENV PATH /workspace/node_modules/.bin:$PATH
WORKDIR /workspace
WORKDIR /tmp
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:
##
######################################################################################
FROM builder AS buildBack
COPY back/pom.xml back/Formatter.xml ./
FROM builder AS build_back
COPY back/pom.xml ./
COPY back/Formatter.xml ./
COPY back/src ./src/
RUN mvn clean compile assembly:single
@ -27,27 +35,44 @@ RUN mvn clean compile assembly:single
## 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
ADD front/package.json \
front/karma.conf.js \
front/protractor.conf.js \
front/pnpm-lock.yaml \
./
ADD front/src/theme ./src/theme
# install and cache app dependencies
RUN pnpm install
RUN pnpm install --prod=false
ADD front/e2e \
###############################################################
## Install sources
###############################################################
FROM dependency_front AS load_sources_front
# JUST to get the vertion of the application and his sha...
COPY front/build.js \
front/version.txt \
front/tsconfig.json \
front/tslint.json \
front/angular.json \
front/tsconfig.node.json \
front/vite.config.mts \
front/index.html \
./
ADD front/src ./src
COPY front/public ./public
COPY front/src ./src
# generate build
RUN ng build --output-path=dist --configuration=production --base-href=/karso/ --deploy-url=/karso/ karso
#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
# add wget to manage the health check...
RUN apk add --no-cache wget
#FROM bellsoft/liberica-openjdk-alpine:latest
## add wget to manage the health check...
#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
COPY --from=buildFront /workspace/dist /application/front/
ENV LANG C.UTF-8
COPY --from=build_back /tmp/out/maven/*.jar /application/application.jar
COPY --from=build_front /tmp/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

View File

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