|
| 1 | +FROM rust:alpine as build |
| 2 | + |
| 3 | +ENV RUSTFLAGS="-C target-feature=-crt-static" |
| 4 | +ENV RUN_MODE="build" |
| 5 | +# these settings are needed for the admin web gui build, these variables are all baked into the Vue application and thus |
| 6 | +# are available to any end user that wants to dig deep enough in the webpage - as such we don't feel it a security risk |
| 7 | +# to have these env variables available to anyone running the history commmand on the container/image |
| 8 | +ENV VUE_APP_BUNDLED_BUILD="true" |
| 9 | +ENV VUE_APP_DEEP_LYNX_API_URL="http://localhost:8090" |
| 10 | +ENV VUE_APP_DEEP_LYNX_API_AUTH_METHOD="token" |
| 11 | +ENV VUE_APP_TIME_SERIES_ENABLED="true" |
| 12 | +# you must include the trailing /# - because the bundled admin web app will be in hash mode, not history |
| 13 | +ENV VUE_APP_APP_URL="http://localhost:8090/#" |
| 14 | +# this should be an alphanumeric random string of at least 15 characters |
| 15 | +ENV VUE_APP_DEEP_LYNX_APP_ID="root" |
| 16 | + |
| 17 | +# turn off jobs on the main thread as this spins up PM2 with the worker |
| 18 | +ENV RUN_JOBS=false |
| 19 | +# set the default db to the one we'd see in the docker compose |
| 20 | +ENV CORE_DB_CONNECTION_STRING=postgresql://postgres:root@postgres:5432/deep_lynx_dev |
| 21 | + |
| 22 | +# Add missing packages |
| 23 | +RUN apk --no-check-certificate add wget ca-certificates |
| 24 | + |
| 25 | +# Configure certs below |
| 26 | + |
| 27 | + |
| 28 | +RUN apk update |
| 29 | +RUN apk add --no-cache build-base musl-dev openssl openssl-dev |
| 30 | +RUN apk update add --update nodejs=21.7.3 |
| 31 | +RUN apk add --update npm |
| 32 | +RUN npm config set strict-ssl false |
| 33 | +# Install corepack separately so it is found during builds. |
| 34 | +RUN npm install -g corepack @napi-rs/cli # this is needed for the Rust/Node library interopt |
| 35 | +RUN npm install npm@latest --location=global |
| 36 | +RUN npm update --location=global |
| 37 | +RUN npm install cargo-cp-artifact --location=global |
| 38 | +RUN corepack enable # enables the yarn commands |
| 39 | + |
| 40 | +RUN mkdir -p /srv/deeplynx |
| 41 | +WORKDIR /srv/deeplynx |
| 42 | + |
| 43 | + |
| 44 | +COPY . . |
| 45 | + |
| 46 | +# triple check we're not pulling in node_modules from the host system |
| 47 | +RUN rm -rf /srv/deeplynx/server/node_modules |
| 48 | +RUN rm -rf /srv/deeplynx/ui/AdminWebApp/node_modules |
| 49 | +RUN rm -rf /srv/deeplynx/ui/WebGLViewer/node_modules |
| 50 | + |
| 51 | +WORKDIR /srv/deeplynx/server |
| 52 | +RUN yarn install; |
| 53 | +RUN yarn run build; |
| 54 | + |
| 55 | +FROM node:alpine as production |
| 56 | +ENV DEVELOPMENT_MODE=false |
| 57 | + |
| 58 | +# Add missing packages |
| 59 | +RUN apk --no-check-certificate add wget ca-certificates |
| 60 | + |
| 61 | +# Configure certs below |
| 62 | + |
| 63 | + |
| 64 | +RUN apk update && apk add --no-cache supervisor openssl |
| 65 | +RUN mkdir -p /srv/deeplynx/server |
| 66 | + |
| 67 | +# need pm2 to run legacy server |
| 68 | +RUN npm install npm@latest --location=global |
| 69 | +RUN npm update --location=global |
| 70 | +RUN npm install pm2 --location=global |
| 71 | + |
| 72 | +COPY --from=build /srv/deeplynx/server /srv/deeplynx/server |
| 73 | +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf |
| 74 | + |
| 75 | +EXPOSE 8090 |
| 76 | +CMD /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf |
0 commit comments