mirror of
https://git.victorphan.net/basketballcantho/Teedy_custom.git
synced 2026-08-05 14:03:10 +07:00
65 lines
1.9 KiB
Docker
65 lines
1.9 KiB
Docker
# Stage 1: Build the application
|
|
FROM maven:3.8.6-openjdk-11 AS build
|
|
|
|
# Install Node.js and Grunt (required by the prod profile for JS/CSS compilation)
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
|
|
apt-get install -y nodejs && \
|
|
npm install -g grunt-cli
|
|
|
|
COPY . /usr/src/app
|
|
WORKDIR /usr/src/app
|
|
|
|
# Build with the 'prod' profile so Grunt compiles JS/CSS into dist/
|
|
RUN mvn clean package -DskipTests -Pprod -pl docs-web -am
|
|
|
|
# Stage 2: Runtime environment
|
|
FROM ubuntu:22.04
|
|
LABEL maintainer="b.gamard@sismics.com"
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
ENV LANG C.UTF-8
|
|
ENV LC_ALL C.UTF-8
|
|
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64/
|
|
ENV JAVA_OPTIONS -Dfile.encoding=UTF-8 -Xmx1g
|
|
ENV JETTY_VERSION 11.0.20
|
|
ENV JETTY_HOME /opt/jetty
|
|
|
|
# Install packages
|
|
RUN apt-get update && \
|
|
apt-get -y -q --no-install-recommends install \
|
|
vim less procps unzip wget tzdata openjdk-11-jdk \
|
|
ffmpeg \
|
|
mediainfo \
|
|
tesseract-ocr \
|
|
tesseract-ocr-vie \
|
|
tesseract-ocr-fra \
|
|
tesseract-ocr-eng \
|
|
&& apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
RUN dpkg-reconfigure -f noninteractive tzdata
|
|
|
|
# Install Jetty
|
|
RUN wget -nv -O /tmp/jetty.tar.gz \
|
|
"https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/${JETTY_VERSION}/jetty-home-${JETTY_VERSION}.tar.gz" \
|
|
&& tar xzf /tmp/jetty.tar.gz -C /opt \
|
|
&& mv /opt/jetty* /opt/jetty \
|
|
&& useradd jetty -U -s /bin/false \
|
|
&& chown -R jetty:jetty /opt/jetty \
|
|
&& mkdir /opt/jetty/webapps \
|
|
&& chmod +x /opt/jetty/bin/jetty.sh
|
|
|
|
EXPOSE 8080
|
|
|
|
# Install app
|
|
RUN mkdir /app && \
|
|
cd /app && \
|
|
java -jar /opt/jetty/start.jar --add-modules=server,http,webapp,deploy
|
|
|
|
# Copy build artifacts from Stage 1
|
|
COPY --from=build /usr/src/app/docs.xml /app/webapps/docs.xml
|
|
COPY --from=build /usr/src/app/docs-web/target/docs-web-1.12-SNAPSHOT.war /app/webapps/docs.war
|
|
|
|
WORKDIR /app
|
|
|
|
CMD ["java", "-jar", "/opt/jetty/start.jar"]
|