2021-06-04 20:57:43 +02:00
|
|
|
FROM node:lts-alpine
|
2021-04-17 19:42:38 +02:00
|
|
|
|
2021-06-04 20:57:43 +02:00
|
|
|
# Define some ENV Vars
|
|
|
|
ENV PORT 80
|
|
|
|
ENV DIRECTORY /app
|
|
|
|
ENV 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-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
|
|
|
|
CMD [ "yarn", "build-and-start"]
|