2021-06-04 21:57:43 +03:00
|
|
|
FROM node:lts-alpine
|
2021-04-17 20:42:38 +03:00
|
|
|
|
2021-06-04 21:57:43 +03:00
|
|
|
# Define some ENV Vars
|
|
|
|
ENV PORT 80
|
|
|
|
ENV DIRECTORY /app
|
|
|
|
ENV IS_DOCKER true
|
2021-04-17 20:42:38 +03:00
|
|
|
|
2021-06-04 21:57:43 +03:00
|
|
|
# Create and set the working directory
|
|
|
|
WORKDIR ${DIRECTORY}
|
2021-04-17 20:42:38 +03:00
|
|
|
|
2021-06-04 21:57:43 +03:00
|
|
|
# Copy over both 'package.json' and 'package-lock.json' (if available)
|
|
|
|
COPY package*.json ./
|
2021-06-03 23:40:34 +03:00
|
|
|
|
2021-06-04 21:57:43 +03:00
|
|
|
# Install project dependencies
|
|
|
|
RUN yarn
|
2021-05-24 22:46:58 +03:00
|
|
|
|
2021-06-04 21:57:43 +03:00
|
|
|
# Copy over all project files and folders to the working directory
|
|
|
|
COPY . .
|
2021-04-17 20:42:38 +03:00
|
|
|
|
2021-06-04 21:57:43 +03:00
|
|
|
# Build initial app for production
|
|
|
|
RUN yarn build
|
2021-04-17 20:42:38 +03:00
|
|
|
|
2021-06-04 21:57:43 +03:00
|
|
|
# Expose given port
|
2021-05-24 22:46:58 +03:00
|
|
|
EXPOSE ${PORT}
|
2021-06-04 21:57:43 +03:00
|
|
|
|
|
|
|
# Finally, run start command to serve up the built application
|
2021-06-10 21:46:46 +03: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
|