karso/Dockerfile
2022-05-31 23:45:11 +02:00

119 lines
3.5 KiB
Docker

FROM archlinux:base-devel AS build
######################################################################################
##
## buyilding-end install applications:
##
######################################################################################
# update system
RUN pacman -Syu --noconfirm && pacman-db-upgrade
# install package
RUN pacman -S --noconfirm ant unzip wget openssh git gawk curl tar bash
#install jdk-openjdk java-openjfx
RUN pacman -S --noconfirm jdk-openjdk java-openjfx
# intall maven & gradle
RUN pacman -S --noconfirm maven gradle
# intall npm
RUN pacman -S --noconfirm npm
# clean all the caches Need only on the release environment
# RUN pacman -Scc --noconfirm
ENV PATH_ROOT $PATH
######################################################################################
##
## Build back:
##
######################################################################################
COPY back/pom.xml /tmp/back/
COPY back/src /tmp/back/src/
WORKDIR /tmp/back/
RUN mvn clean compile assembly:single
######################################################################################
##
## Build front:
##
######################################################################################
ENV PATH /tmp/front/node_modules/.bin:$PATH_ROOT
ADD front/package-lock.json /tmp/front/
ADD front/package.json /tmp/front/
ADD front/karma.conf.js /tmp/front/
ADD front/protractor.conf.js /tmp/front/
WORKDIR /tmp/front/
# install and cache app dependencies
RUN npm install
ADD front/e2e /tmp/sso/front
ADD front/tsconfig.json /tmp/front/
ADD front/tslint.json /tmp/front/
ADD front/angular.json /tmp/front/
ADD front/src /tmp/front/src
# generate build
RUN ng build --output-path=dist --configuration=production --base-href=/karauth/ --deploy-url=/karauth/
######################################################################################
##
## Build sso:
##
######################################################################################
ENV PATH /tmp/sso/node_modules/.bin:$PATH_ROOT
ADD sso/package-lock.json /tmp/sso/
ADD sso/package.json /tmp/sso/
ADD sso/karma.conf.js /tmp/sso/
ADD sso/protractor.conf.js /tmp/sso/
WORKDIR /tmp/sso/
# install and cache app dependencies
RUN npm install
ADD sso/e2e /tmp/sso/e2e
ADD sso/tsconfig.json /tmp/sso/
ADD sso/tslint.json /tmp/sso/
ADD sso/angular.json /tmp/sso/
ADD sso/src /tmp/sso/src
# generate build
RUN ng build --output-path=dist --configuration=production --base-href=/karso/ --deploy-url=/karso/
######################################################################################
##
## Production area:
##
######################################################################################
#FROM bellsoft/liberica-openjdk-alpine:latest
# add wget to manage the health check...
#RUN apk add --no-cache wget
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
RUN mkdir /application/
#copy REST API from back:
COPY --from=build /tmp/back/out/maven/*.jar /application/application.jar
# add front software:
RUN mkdir /application/sso/
COPY --from=build /tmp/sso/dist /application/karso/
RUN mkdir /application/karauth/
COPY --from=build /tmp/front/dist /application/karauth/
WORKDIR /application/
EXPOSE 17080
CMD ["java", "-Xms64M", "-Xmx1G", "-cp", "/application/application.jar", "org.kar.oauth.WebLauncher"]