Skip to content

Commit

Permalink
Merge pull request #4133 from devgateway/develop
Browse files Browse the repository at this point in the history
AMP-30476 3.5.5.1 release
  • Loading branch information
jdeanquin-dg authored Oct 6, 2023
2 parents 423728d + 46fb46b commit c15a7cc
Show file tree
Hide file tree
Showing 147 changed files with 4,808 additions and 2,801 deletions.
1 change: 1 addition & 0 deletions amp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ lucene/
rebel.xml
/api-docs/
/derby.log
**/.DS_Store
147 changes: 118 additions & 29 deletions amp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,128 @@
FROM maven:3.8.4-jdk-8 as base
FROM node:16.4.0 as node

FROM node as compile-amp-state
WORKDIR /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-state
COPY TEMPLATE/ampTemplate/node_modules/amp-state .
RUN --mount=type=cache,target=/root/.npm \
npm ci

FROM node as compile-amp-translate
WORKDIR /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-translate
COPY TEMPLATE/ampTemplate/node_modules/amp-translate .
RUN --mount=type=cache,target=/root/.npm \
npm ci

FROM node as compile-amp-boilerplate
WORKDIR /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate
COPY TEMPLATE/ampTemplate/node_modules/amp-boilerplate .
COPY --from=compile-amp-translate /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-translate ../amp-translate
RUN --mount=type=cache,target=/root/.npm \
npm ci \
&& npm run build

FROM node as compile-amp-filter
WORKDIR /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-filter
COPY --from=compile-amp-translate /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-translate ../amp-translate
COPY TEMPLATE/ampTemplate/node_modules/amp-filter .
# HACK otherwise amp-filter won't compile!
COPY TEMPLATE/reamp/tools/log /tmp/amp/TEMPLATE/reamp/tools/log
RUN --mount=type=cache,target=/root/.npm \
npm ci \
&& npm run build

FROM node as compile-amp-settings
WORKDIR /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-settings
COPY --from=compile-amp-translate /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-translate ../amp-translate
COPY TEMPLATE/ampTemplate/node_modules/amp-settings .
RUN --mount=type=cache,target=/root/.npm \
npm ci \
&& npm run build

FROM node as compile-gis-layers-manager
WORKDIR /tmp/amp/TEMPLATE/ampTemplate/node_modules/gis-layers-manager
COPY --from=compile-amp-translate /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-translate ../amp-translate
COPY TEMPLATE/ampTemplate/node_modules/gis-layers-manager .
RUN --mount=type=cache,target=/root/.npm \
npm ci \
&& npm run build

FROM node as compile-gis-module
WORKDIR /tmp/amp/TEMPLATE/ampTemplate/gisModule
COPY --from=compile-amp-state /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-state ../node_modules/amp-state
COPY --from=compile-amp-translate /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-translate ../node_modules/amp-translate
COPY --from=compile-amp-boilerplate /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate ../node_modules/amp-boilerplate
COPY --from=compile-amp-filter /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-filter ../node_modules/amp-filter
# HACK otherwise amp-filter won't compile!
COPY TEMPLATE/reamp/tools/log /tmp/amp/TEMPLATE/reamp/tools/log
COPY --from=compile-amp-settings /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-settings ../node_modules/amp-settings
COPY --from=compile-gis-layers-manager /tmp/amp/TEMPLATE/ampTemplate/node_modules/gis-layers-manager ../node_modules/gis-layers-manager
COPY TEMPLATE/ampTemplate/gisModule .
RUN --mount=type=cache,target=/root/.npm \
cd dev \
&& npm ci \
&& npm run test \
&& npm run build \
&& rm -rf node_modules

FROM node as compile-dashboard
WORKDIR /tmp/amp/TEMPLATE/ampTemplate/dashboard
COPY --from=compile-amp-state /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-state ../node_modules/amp-state
COPY --from=compile-amp-translate /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-translate ../node_modules/amp-translate
COPY --from=compile-amp-boilerplate /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate ../node_modules/amp-boilerplate
COPY --from=compile-amp-filter /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-filter ../node_modules/amp-filter
# HACK otherwise amp-filter won't compile!
COPY TEMPLATE/reamp/tools/log /tmp/amp/TEMPLATE/reamp/tools/log
COPY --from=compile-amp-settings /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-settings ../node_modules/amp-settings
COPY TEMPLATE/ampTemplate/node_modules/amp-url ../node_modules/amp-url
COPY TEMPLATE/ampTemplate/dashboard .
RUN --mount=type=cache,target=/root/.npm \
cd dev \
&& npm ci \
&& npm run build \
&& rm -rf node_modules

FROM node as compile-reamp
WORKDIR /tmp/amp/TEMPLATE/reamp
COPY --from=compile-amp-boilerplate /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate ../ampTemplate/node_modules/amp-boilerplate
COPY TEMPLATE/reamp .
RUN --mount=type=cache,target=/root/.npm \
--mount=type=ssh \
npm ci \
&& npm run build \
&& rm -rf node_modules

FROM node as compile-reampv2
WORKDIR /tmp/amp/TEMPLATE/reampv2
COPY --from=compile-amp-boilerplate /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate ../ampTemplate/node_modules/amp-boilerplate
COPY --from=compile-amp-filter /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-filter ../ampTemplate/node_modules/amp-filter
COPY --from=compile-amp-settings /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-settings ../ampTemplate/node_modules/amp-settings
COPY TEMPLATE/reampv2 .
RUN --mount=type=cache,target=/root/.npm \
--mount=type=ssh \
npm ci \
&& npm run build \
&& rm -rf node_modules

FROM maven:3.8.4-jdk-8 as compile-mvn
WORKDIR /tmp/amp
COPY . .

FROM base as compile
COPY --from=compile-amp-boilerplate /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate/dist TEMPLATE/ampTemplate/node_modules/amp-boilerplate/dist
COPY --from=compile-amp-filter /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-filter/dist TEMPLATE/ampTemplate/node_modules/amp-filter/dist
COPY --from=compile-amp-settings /tmp/amp/TEMPLATE/ampTemplate/node_modules/amp-settings/dist TEMPLATE/ampTemplate/node_modules/amp-settings/dist
COPY --from=compile-gis-layers-manager /tmp/amp/TEMPLATE/ampTemplate/node_modules/gis-layers-manager/dist TEMPLATE/ampTemplate/node_modules/gis-layers-manager/dist
COPY --from=compile-gis-module /tmp/amp/TEMPLATE/ampTemplate/gisModule/dist TEMPLATE/ampTemplate/gisModule/dist
COPY --from=compile-dashboard /tmp/amp/TEMPLATE/ampTemplate/dashboard/build TEMPLATE/ampTemplate/dashboard/build
COPY --from=compile-reamp /tmp/amp/TEMPLATE/reamp TEMPLATE/reamp
COPY --from=compile-reampv2 /tmp/amp/TEMPLATE/reampv2/build TEMPLATE/reampv2/build
ARG BUILD_SOURCE
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
RUN --mount=type=ssh \
--mount=type=cache,target=/root/.m2 \
--mount=type=cache,target=/root/.npm \
RUN --mount=type=cache,target=/root/.m2 \
mvn -B test war:exploded \
-DbuildSource=$BUILD_SOURCE \
-Djdbc.user=amp -Djdbc.password=amp122006 -Djdbc.db=amp -Djdbc.host=db \
-Djdbc.port=5432 -DdbName=postgresql -Djdbc.driverClassName=org.postgresql.Driver \
-Dskip.npm -Dskip.installnodenpm \
&& mv target/amp exploded \
&& rm -rf target \
TEMPLATE/ampTemplate/node_modules/amp-boilerplate/node \
TEMPLATE/ampTemplate/node_modules/amp-boilerplate/node_modules \
TEMPLATE/ampTemplate/node_modules/gis-layers-manager/node \
TEMPLATE/ampTemplate/node_modules/gis-layers-manager/node_modules \
TEMPLATE/ampTemplate/node_modules/amp-settings/node \
TEMPLATE/ampTemplate/node_modules/amp-settings/node_modules \
TEMPLATE/ampTemplate/node_modules/amp-translate/node \
TEMPLATE/ampTemplate/node_modules/amp-translate/node_modules \
TEMPLATE/ampTemplate/node_modules/amp-state/node \
TEMPLATE/ampTemplate/node_modules/amp-state/node_modules \
TEMPLATE/ampTemplate/node_modules/amp-filter/node \
TEMPLATE/ampTemplate/node_modules/amp-filter/node_modules \
TEMPLATE/ampTemplate/gisModule/dev/node \
TEMPLATE/ampTemplate/gisModule/dev/node_modules \
TEMPLATE/ampTemplate/dashboard/dev/node \
TEMPLATE/ampTemplate/dashboard/dev/node_modules \
TEMPLATE/reamp/node \
TEMPLATE/reamp/node_modules \
TEMPLATE/reampv2/node \
TEMPLATE/reampv2/node_modules
&& rm -rf target

FROM tomcat:8.5.79-jdk8

Expand Down Expand Up @@ -62,4 +151,4 @@ LABEL "branch"=$AMP_BRANCH
ENV AMP_REGISTRY_PRIVATE_KEY $AMP_REGISTRY_PRIVATE_KEY

RUN rm -fr /usr/local/tomcat/webapps/ROOT
COPY --from=compile /tmp/amp/exploded /usr/local/tomcat/webapps/ROOT/
COPY --from=compile-mvn /tmp/amp/exploded /usr/local/tomcat/webapps/ROOT/
Loading

0 comments on commit c15a7cc

Please sign in to comment.