2021-08-15 12:24:04 +02:00
|
|
|
FROM node:lts-alpine3.14
|
2021-08-15 01:03:06 +02:00
|
|
|
|
|
|
|
# Define some ENV Vars
|
|
|
|
ENV PORT=80 \
|
2021-08-15 12:24:04 +02:00
|
|
|
DIRECTORY=/app \
|
|
|
|
IS_DOCKER=true
|
2021-08-15 01:03:06 +02:00
|
|
|
|
|
|
|
# Create and set the working directory
|
|
|
|
WORKDIR ${DIRECTORY}
|
|
|
|
|
2021-08-15 12:24:04 +02:00
|
|
|
# Copy over both 'package.json' and 'package-lock.json' (if available)
|
|
|
|
COPY package*.json ./
|
|
|
|
COPY yarn.lock ./
|
2021-08-15 01:03:06 +02:00
|
|
|
|
2021-08-15 12:24:04 +02:00
|
|
|
# Install project dependencies
|
|
|
|
RUN yarn
|
2021-06-04 20:57:43 +02:00
|
|
|
|
2021-08-15 12:24:04 +02:00
|
|
|
# Copy over all project files and folders to the working directory
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# Build initial app for production
|
|
|
|
RUN yarn build
|
2021-06-10 20:46:46 +02:00
|
|
|
|
2021-08-15 01:03:06 +02:00
|
|
|
# Expose given port
|
|
|
|
EXPOSE ${PORT}
|
2021-08-15 01:23:29 +02:00
|
|
|
|
2021-08-15 12:24:04 +02:00
|
|
|
# Finally, run start command to serve up the built application
|
|
|
|
CMD [ "yarn", "build-and-start"]
|
|
|
|
|
2021-08-15 01:23:29 +02:00
|
|
|
# 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
|