2022-06-15 17:42:15 -06:00
|
|
|
# XXX: Before updating this, make sure the issues around `npm` silently exiting
|
|
|
|
# with error 243 issues are solved:
|
|
|
|
# - https://github.com/npm/cli/issues/4996
|
|
|
|
# - https://github.com/npm/cli/issues/4769
|
2023-05-01 23:39:01 -06:00
|
|
|
FROM node:18.16.0-buster-slim
|
2022-06-15 01:28:18 -06:00
|
|
|
|
2023-04-24 22:50:53 -06:00
|
|
|
# Pass through some GitHub CI variables which we use in the build (for version
|
|
|
|
# files/tags)
|
2022-09-08 00:30:04 -06:00
|
|
|
ARG GITHUB_SHA
|
|
|
|
ENV GITHUB_SHA=$GITHUB_SHA
|
|
|
|
ARG GITHUB_REF
|
|
|
|
ENV GITHUB_REF=$GITHUB_REF
|
|
|
|
|
2022-06-15 01:28:18 -06:00
|
|
|
RUN mkdir -p /app
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2022-06-15 16:12:44 -06:00
|
|
|
# Copy the health-check script
|
|
|
|
COPY docker-health-check.js /app/
|
|
|
|
|
2022-06-15 01:28:18 -06:00
|
|
|
# Copy just what we need to install the dependencies so this layer can be cached
|
|
|
|
# in the Docker build
|
|
|
|
COPY package.json package-lock.json /app/
|
|
|
|
RUN npm install
|
|
|
|
|
|
|
|
# Copy what we need for the client-side build
|
2022-06-15 16:12:44 -06:00
|
|
|
COPY config /app/config/
|
2023-04-07 12:17:46 -06:00
|
|
|
COPY build-scripts /app/build-scripts/
|
2023-04-24 22:50:53 -06:00
|
|
|
COPY client /app/client/
|
2022-06-15 01:28:18 -06:00
|
|
|
COPY shared /app/shared/
|
2023-04-24 22:50:53 -06:00
|
|
|
# Also copy the server stuff (we reference the config from the `build-client.js`)
|
|
|
|
COPY server /app/server/
|
2022-06-15 01:28:18 -06:00
|
|
|
# Build the client-side bundle
|
|
|
|
RUN npm run build
|
|
|
|
|
2022-06-15 16:12:44 -06:00
|
|
|
HEALTHCHECK CMD node docker-health-check.js
|
|
|
|
|
|
|
|
ENTRYPOINT ["/bin/bash", "-c", "npm start"]
|