1 min readDec 14, 2017
Hello Rogério. Thanks for sharing your experience. I have worked on a similar project but here are some differences compared to what you have done.
I have multi-stage docker build with 2 different images: the first one is node
and the second one is nginx
. It would look like this :
FROM node:alpine AS build
ENV NODE_ENV=development
WORKDIR /tmp
#Clone from git or copy from local folder in my case
COPY . .
# Do your build here, I use yarn
RUN yarn \
&& yarn run build-storybook#Here I start from a new nginx image
FROM nginx:alpine
COPY --from=build /tmp/storybook-static/ /usr/share/nginx/html/
This way, I am sure to have only nginx in the final image as node itself is not needed there.
Also I love to use the alpine
version of the images when possible as it uses less space for me (I run these builds in CI)