107 lines
3.1 KiB
Docker
107 lines
3.1 KiB
Docker
######################################################################################
|
|
##
|
|
## buyilding-end install applications:
|
|
##
|
|
######################################################################################
|
|
FROM archlinux:base-devel AS common
|
|
# update system
|
|
RUN pacman -Syu --noconfirm && pacman-db-upgrade \
|
|
&& pacman -S --noconfirm jdk-openjdk \
|
|
&& pacman -Scc --noconfirm
|
|
|
|
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 build_back
|
|
COPY back/pom.xml ./
|
|
COPY back/Formatter.xml ./
|
|
COPY back/src ./src/
|
|
RUN mvn clean compile assembly:single
|
|
|
|
######################################################################################
|
|
##
|
|
## Build front:
|
|
##
|
|
######################################################################################
|
|
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/pnpm-lock.yaml \
|
|
./
|
|
ADD front/src/theme ./src/theme
|
|
|
|
# install and cache app dependencies
|
|
RUN pnpm install --prod=false
|
|
|
|
###############################################################
|
|
## 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/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
|
|
|
|
######################################################################################
|
|
##
|
|
## Production area:
|
|
##
|
|
######################################################################################
|
|
|
|
#FROM bellsoft/liberica-openjdk-alpine:latest
|
|
## add wget to manage the health check...
|
|
#RUN apk add --no-cache wget
|
|
FROM common
|
|
|
|
#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
|
|
|
|
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
|
|
|
|
CMD ["java", "-Xms64M", "-Xmx1G", "-cp", "/application/application.jar", "org.kar.karusic.WebLauncher"]
|