2021-08-11 22:29:09 +02:00
|
|
|
FROM node:lts-alpine3.14
|
2021-04-17 19:42:38 +02:00
|
|
|
|
2021-06-04 20:57:43 +02:00
|
|
|
# Define some ENV Vars
|
2021-08-07 16:35:45 +02:00
|
|
|
ENV PORT=80 \
|
|
|
|
DIRECTORY=/app \
|
|
|
|
IS_DOCKER=true
|
2021-04-17 19:42:38 +02:00
|
|
|
|
2021-06-04 20:57:43 +02:00
|
|
|
# Create and set the working directory
|
|
|
|
WORKDIR ${DIRECTORY}
|
2021-04-17 19:42:38 +02:00
|
|
|
|
2021-06-04 20:57:43 +02:00
|
|
|
# Copy over both 'package.json' and 'package-lock.json' (if available)
|
|
|
|
COPY package*.json ./
|
2021-08-09 12:47:27 +02:00
|
|
|
COPY yarn.lock ./
|
2021-06-03 22:40:34 +02:00
|
|
|
|
2021-06-04 20:57:43 +02:00
|
|
|
# Install project dependencies
|
|
|
|
RUN yarn
|
2021-05-24 21:46:58 +02:00
|
|
|
|
2021-06-04 20:57:43 +02:00
|
|
|
# Copy over all project files and folders to the working directory
|
|
|
|
COPY . .
|
2021-04-17 19:42:38 +02:00
|
|
|
|
2021-06-04 20:57:43 +02:00
|
|
|
# Build initial app for production
|
|
|
|
RUN yarn build
|
2021-04-17 19:42:38 +02:00
|
|
|
|
2021-06-04 20:57:43 +02:00
|
|
|
# Expose given port
|
2021-05-24 21:46:58 +02:00
|
|
|
EXPOSE ${PORT}
|
2021-06-04 20:57:43 +02:00
|
|
|
|
|
|
|
# Finally, run start command to serve up the built application
|
2021-06-10 20:46:46 +02:00
|
|
|
CMD [ "yarn", "build-and-start"]
|
|
|
|
|
|
|
|
# Run simple healthchecks every 5 mins, to check the Dashy's everythings great
|
|
|
|
HEALTHCHECK --interval=5m --timeout=2s --start-period=30s CMD yarn health-check
|