Skip to content

Instantly share code, notes, and snippets.

@bsod90
Created September 9, 2017 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsod90/f048ec24e1779ac40f0522c3948cd2dd to your computer and use it in GitHub Desktop.
Save bsod90/f048ec24e1779ac40f0522c3948cd2dd to your computer and use it in GitHub Desktop.
Dockerfile before multi-stage
FROM nginx
# Install nodejs and try to cleanup some space in a single command
RUN apt-get update \
&& apt-get install -y curl python build-essential \
&& curl -sL https://deb.nodesource.com/setup_6.x | bash — \
&& apt-get install -y nodejs \
&& apt-get purge -y python build-essential \
&& apt autoremove -y \
&& apt-get clean -y
RUN mkdir -p /onebar/ui
# Add nginx configs
ADD ./deploy/configs/nginx/docker.conf /etc/nginx/nginx.conf
ADD ./deploy/configs/nginx/k8s.conf /etc/nginx/nginx.conf.k8s
ADD ./deploy/nginx-entrypoint.sh /root/nginx-entrypoint.sh
ADD ./onebar/static /onebar/static
RUN echo ‘{ “allow_root”: true }’ > /root/.bowerrc
ADD ui/ /onebar/ui
WORKDIR /onebar/ui
RUN npm install -g ember-cli
RUN npm install -g bower
# Combine all package installations into one step
# followed by the clean-up
# This saves us a little bit of space, but prevents us
# from making node modules a separate layer
RUN apt-get update && apt-get install -y git \
&& npm install \
&& bower install \
&& apt-get -y purge git \
&& apt autoremove -y \
&& apt-get -y clean \
&& rm -rf /root/.npm
RUN ember build — environment=production
CMD [ “/root/nginx-entrypoint.sh”, “nginx”, “-g”, “daemon off;” ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment