From 430673b8a863f7560137aa8a57e0652e3b66716c Mon Sep 17 00:00:00 2001 From: John Costanzo Date: Wed, 28 Mar 2018 18:30:19 -0400 Subject: [PATCH] Concatenating RUN commands into 1. Adding entrypoint to start --- Dockerfile | 46 +++++++++++++--------------------------------- entrypoint.sh | 15 +++++++++++++++ 2 files changed, 28 insertions(+), 33 deletions(-) create mode 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index a7449d6..8719984 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,33 +7,24 @@ MAINTAINER Dan Lynn EXPOSE 4200 7020 5779 WORKDIR /myapp +COPY ./entrypoint.sh /entrypoint.sh + # run ember server on container start -CMD ["ember", "server"] +CMD ["sh", "/entrypoint.sh"] -# Install watchman build dependencies -RUN \ - apt-get update -y &&\ - apt-get install -y python-dev - -# install watchman -# Note: See the README.md to find out how to increase the -# fs.inotify.max_user_watches value so that watchman will -# work better with ember projects. +# Install watchman build dependencies RUN \ - git clone https://github.com/facebook/watchman.git &&\ + apt-get update -y &&\ + apt-get install -y python-dev &&\ + git clone https://github.com/facebook/watchman.git &&\ cd watchman &&\ git checkout v4.7.0 &&\ ./autogen.sh &&\ ./configure &&\ make &&\ - make install - -# install bower -RUN \ - npm install -g bower@1.8.2 - -# install chrome for default testem config (as of 2.15.0) -RUN apt-get update &&\ + make install &&\ + npm install -g bower@1.8.2 &&\ + apt-get update &&\ apt-get install -y \ apt-transport-https \ gnupg \ @@ -43,18 +34,7 @@ RUN apt-get update &&\ apt-get update &&\ apt-get install -y \ google-chrome-stable \ - --no-install-recommends - -# tweak chrome to run with --no-sandbox option -RUN \ - sed -i 's/"$@"/--no-sandbox "$@"/g' /opt/google/chrome/google-chrome - -# set container bash prompt color to blue in order to -# differentiate container terminal sessions from host -# terminal sessions -RUN \ - echo 'PS1="\[\\e[0;94m\]${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\\\$\[\\e[m\] "' >> ~/.bashrc - -# Install ember-cli -RUN \ + --no-install-recommends &&\ + sed -i 's/"$@"/--no-sandbox "$@"/g' /opt/google/chrome/google-chrome &&\ + echo 'PS1="\[\\e[0;94m\]${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\\\$\[\\e[m\] "' >> ~/.bashrc &&\ npm install -g ember-cli@3.0.0 diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..95a0ef9 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Install your NPM dependencies +if [ -f "yarn.lock" ]; then + yarn install +else + npm install +fi + +# If bower.json exists then do a bower install +if [ -f "bower.json" ]; then + bower install +fi + +ember server \ No newline at end of file