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
|
|
|
|
CMD [ "yarn", "build-and-start"]
|