Last active
July 6, 2019 17:41
-
-
Save armand1m/b96d8e7f82cec7be6371ed8e28153e77 to your computer and use it in GitHub Desktop.
Dockerfile for serving static assets from a CRA-generated application build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stage 1 - prepare application dependencies and bundle it | |
FROM node:dubnium as build-assets | |
WORKDIR /usr/src/app | |
COPY package.json package-lock.json ./ | |
RUN npm ci | |
COPY . ./ | |
RUN npm run build | |
# Stage 2 - serve only build assets through a static server | |
FROM node:dubnium | |
RUN npm i --global serve | |
COPY --from=build-assets /usr/src/app/build /usr/src/app/build | |
EXPOSE 5000 | |
CMD ["serve", "-s", "/usr/src/app/build"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment