-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
99 lines (78 loc) · 3 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# # # # # # # # # # # # # # # # #
#
# Build Container Definition
#
# # # # # # # # # # # # # # # # #
FROM alpine:3.18.2 AS build
# Add our node installation bin path to the global $PATH var.
ENV PATH="$PATH:/opt/node/bin"
# NodeJS depends libstdc++ to run.
RUN apk add libstdc++
# Install NodeJS as well as yarn
RUN cd /opt \
&& wget https://unofficial-builds.nodejs.org/download/release/v16.17.1/node-v16.17.1-linux-x64-musl.tar.gz -O node-v16.17.1-linux-x64-musl.tar.gz \
&& tar -xf node-v16.17.1-linux-x64-musl.tar.gz \
&& rm node-v16.17.1-linux-x64-musl.tar.gz \
&& mv node-v16.17.1-linux-x64-musl node \
&& npm i -g yarn \
&& mkdir /project
# Build directory
WORKDIR /project
# Copy over only the needed files for the build (otherwise the build context is
# measured in gigabytes and the docker build takes a _long_ time).
COPY .yarn .yarn
COPY tools tools
COPY .yarnrc.yml .yarnrc.yml
COPY nx.json nx.json
COPY package.json package.json
COPY yarn.lock yarn.lock
COPY packages packages
ARG NODE_OPTIONS=--max-old-space-size=4096
# Build the client bundles
# RUN echo "Building with NODE_OPTIONS=$NODE_OPTIONS"
RUN yarn \
&& yarn nx run-many --target=bundle:npm --parallel=1
# # # # # # # # # # # # # # # # #
#
# Runtime Container Definition
#
# # # # # # # # # # # # # # # # #
FROM nginx:alpine3.17-perl
# Add our node installation bin path to the global $PATH var.
ENV PATH="$PATH:/opt/node/bin"
# NodeJS depends libstdc++ to run.
RUN apk add libstdc++
# Copy over our node installation from the build image.
COPY --from=build /opt/node /opt/node
# Copy over the files we need for this image from the build context.
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY docker /etc/veupathdb
# Install directory for the getBundlesSubPath script.
WORKDIR /etc/veupathdb
# Build the getBundlesSubPath script.
RUN npm i -g yarn \
&& yarn install \
&& chmod +x makeSupportedBrowsersScript.js \
&& ./makeSupportedBrowsersScript.js > getBundlesSubPath \
&& chmod +x getBundlesSubPath
# File host source directory.
WORKDIR /var/www
# Important!!
#
# We flip the order of the directories here for NGINX path rewrites!
#
# clinepi/legacy => legacy/clinepi
# genomics/modern => modern/genomics
# etc...
# Clinepi
COPY --from=build /project/node_modules/@veupathdb/clinepi-site/dist/bundles/legacy legacy/clinepi/
COPY --from=build /project/node_modules/@veupathdb/clinepi-site/dist/bundles/modern modern/clinepi/
# Genomics
COPY --from=build /project/node_modules/@veupathdb/genomics-site/dist/bundles/legacy legacy/genomics/
COPY --from=build /project/node_modules/@veupathdb/genomics-site/dist/bundles/modern modern/genomics/
# MBio
COPY --from=build /project/node_modules/@veupathdb/mbio-site/dist/bundles/legacy legacy/mbio/
COPY --from=build /project/node_modules/@veupathdb/mbio-site/dist/bundles/modern modern/mbio/
# Ortho
COPY --from=build /project/node_modules/@veupathdb/ortho-site/dist/bundles/legacy legacy/ortho/
COPY --from=build /project/node_modules/@veupathdb/ortho-site/dist/bundles/modern modern/ortho/