-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (41 loc) · 1.35 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
ARG node_version=18.16-slim
# Base stage for building Java app
FROM openjdk:11 as base
RUN apt-get update && apt-get install -y wget libxml2-utils
RUN wget https://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/10.5/Saxon-HE-10.5.jar \
&& mkdir -p /usr/share/java \
&& mv Saxon-HE-10.5.jar /usr/share/java/saxon.jar
RUN echo "#!/bin/bash\njava -jar /usr/share/java/saxon.jar -s:\$1 -xsl:\$2" > /usr/local/bin/apply-xslt
RUN chmod +x /usr/local/bin/apply-xslt
FROM base as apply-xslt
ENTRYPOINT ["apply-xslt"]
FROM base as test
WORKDIR /app
COPY . /app
ENTRYPOINT ["/app/project_tests.sh"]
FROM node:${node_version} as node_base
WORKDIR /app
COPY package*.json ./
COPY yarn.lock ./
RUN yarn install
COPY . .
RUN yarn build
RUN yarn install --production
FROM base as api
WORKDIR /app
COPY --from=node_base /usr/local/bin/node /usr/local/bin/
COPY --from=node_base /app/node_modules ./node_modules
COPY --from=node_base /app/dist ./dist
COPY scripts ./scripts
RUN chmod +x -R ./scripts/*
COPY src ./src
ENV PORT 80
CMD [ "node", "dist/server.js" ]
# Add a healthcheck
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl -H 'X-Passthrough: true' -f http://localhost:80/ -d '<test></test>' || exit 1
FROM base as prod
WORKDIR /app
COPY scripts ./scripts
RUN chmod +x -R ./scripts/*
COPY src ./src
ENTRYPOINT ["/app/scripts/transform.sh"]