|
| 1 | +############################ |
| 2 | +# Builder |
| 3 | +############################ |
| 4 | + |
| 5 | +FROM artifactory.jpl.nasa.gov:17001/node:lts-iron as builder |
| 6 | + |
| 7 | +# Add git |
| 8 | +RUN apt-get update \ |
| 9 | + && apt-get install -y git |
| 10 | + |
| 11 | +# Create app directory |
| 12 | +WORKDIR /usr/src/app |
| 13 | + |
| 14 | +# Bundle entire app source |
| 15 | +COPY . . |
| 16 | + |
| 17 | +RUN npx browserslist@latest --update-db |
| 18 | + |
| 19 | +# Force production env |
| 20 | +RUN npm ci NODE_ENV=production |
| 21 | + |
| 22 | +# (MAYBE) Set the subpath we're going to server at |
| 23 | +# ARG PUBLIC_URL=/beta |
| 24 | +# ENV PUBLIC_URL=/beta |
| 25 | + |
| 26 | +# Build client and server |
| 27 | +RUN npm run build |
| 28 | + |
| 29 | + |
| 30 | +############################# |
| 31 | +# Switch to Atlas Documentation project |
| 32 | +############################# |
| 33 | + |
| 34 | +WORKDIR /usr/src/app/Documentation |
| 35 | + |
| 36 | +# Bundle entire app source |
| 37 | +COPY . . |
| 38 | + |
| 39 | +RUN npm ci NODE_ENV=production |
| 40 | + |
| 41 | +RUN npm run build |
| 42 | + |
| 43 | +WORKDIR /usr/src/app/ |
| 44 | + |
| 45 | + |
| 46 | +############################ |
| 47 | +# Runner |
| 48 | +############################ |
| 49 | + |
| 50 | +FROM artifactory.jpl.nasa.gov:17001/node:lts-iron as runner |
| 51 | + |
| 52 | +# Create app directory |
| 53 | +WORKDIR /usr/src/app |
| 54 | + |
| 55 | +# Contains script macros and metadata |
| 56 | +COPY package*.json ./ |
| 57 | + |
| 58 | +COPY config/paths.js ./config/ |
| 59 | +COPY scripts/start-prod.js ./scripts/ |
| 60 | + |
| 61 | +# Not all server side packages get bundled |
| 62 | +RUN npm ci NODE_ENV=production |
| 63 | + |
| 64 | +# All our needed scripts neatly come from here |
| 65 | +COPY --from=builder /usr/src/app/build ./build |
| 66 | + |
| 67 | +EXPOSE 8500 |
| 68 | +CMD [ "npm", "run", "start:prod" ] |
0 commit comments