1+ # ######################################
2+ # Multi-stage Dockerfile
3+ # 1. Set up the build environment
4+ # 2. Build Edirom-Online packages
5+ # 3. Run the nginx and deploy frontend
6+ # ######################################
7+
8+
9+ # ########################
10+ # 1. Build Environment
11+ # ########################
12+
13+ FROM eclipse-temurin:8-jdk-focal as builder
14+
15+ ARG ANT_VERSION=1.10.12
16+ ARG BE_PORT=8080
17+
18+
19+ # Install wget and unzip and ruby and other dependencies
20+ RUN apt-get update && apt-get install -y --no-install-recommends \
21+ curl \
22+ sudo \
23+ wget \
24+ git \
25+ unzip \
26+ libfreetype6 \
27+ fontconfig \
28+ ruby-full \
29+ && rm -rf /var/lib/apt/lists/*
30+
31+ # Download and extract Apache Ant to opt folder
32+ RUN wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \
33+ wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \
34+ echo "$(cat apache-ant-${ANT_VERSION}-bin.tar.gz.sha512) apache-ant-${ANT_VERSION}-bin.tar.gz" | sha512sum -c && \
35+ tar -zvxf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ && \
36+ ln -s /opt/apache-ant-${ANT_VERSION} /opt/ant && \
37+ unlink apache-ant-${ANT_VERSION}-bin.tar.gz && \
38+ unlink apache-ant-${ANT_VERSION}-bin.tar.gz.sha512
39+
40+ # Download and install SenchaCmd Community Edition
41+ RUN curl --silent http://cdn.sencha.com/cmd/7.0.0.40/no-jre/SenchaCmd-7.0.0.40-linux-amd64.sh.zip -o /tmp/senchaCmd.zip && \
42+ unzip /tmp/senchaCmd.zip -d /tmp && \
43+ unlink /tmp/senchaCmd.zip && \
44+ chmod o+x /tmp/SenchaCmd-7.0.0.40-linux-amd64.sh && \
45+ /tmp/SenchaCmd-7.0.0.40-linux-amd64.sh -Dall=true -q -dir /opt/Sencha/Cmd/7.0.0.40 && \
46+ unlink /tmp/SenchaCmd-7.0.0.40-linux-amd64.sh
47+
48+ # Put ant and sencha in the path
49+ ENV PATH="/opt/ant/bin:/opt/Sencha/Cmd:${PATH}"
50+
51+
52+ # ###########################
53+ # 2. Edirom-Online Frontend
54+ # ###########################
55+
56+ # Get build for Edirom-Online Frontend
57+ WORKDIR /opt/eo-frontend
58+
59+ COPY . .
60+
61+ RUN echo "Writing backend.port=$BE_PORT to local.properties…" ; \
62+ if [ -f "./local.properties" ]; then \
63+ sed -i '/^backend\. port=/d' local.properties; \
64+ echo "backend.port=$BE_PORT" >> local.properties; \
65+ else \
66+ echo "backend.port=$BE_PORT" >> local.properties; \
67+ fi && \
68+ echo "Building Frontend XAR..." && \
69+ ./build.sh
70+
71+ # ########################
72+ # 3. Run/deploy nginx
73+ # ########################
74+
75+ # Use nginx as the base image
76+ FROM nginx:alpine
77+
78+ # copy build files to directory
79+ COPY --from=builder /opt/eo-frontend/build/ /usr/share/nginx/html/
0 commit comments