Skip to content

Instantly share code, notes, and snippets.

@penguinpowernz
Created September 6, 2016 07:25
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 penguinpowernz/42af90b30b60d229405dd84bb15cc58c to your computer and use it in GitHub Desktop.
Save penguinpowernz/42af90b30b60d229405dd84bb15cc58c to your computer and use it in GitHub Desktop.
FROM node:argon
# change this to uncache and rebuilt the image
ENV DOCKERFILE_VERSION=0.0.1
RUN mkdir -p /usr/src/app
RUN npm install -g strongloop pm2
# install debian packages
RUN apt-get update
RUN DEBIAN_FRONTEND=none apt-get install redis-server -y --force-yes
# disable redis, we will let PM2 handle that
RUN systemctl disable redis-server
# copy the package.json and the modules and do initial install
COPY . /usr/src/app
# COPY . /tmp/app
# RUN cp -RfL /tmp/app/* /usr/src/app || echo "symlinks"
RUN cd /usr/src/app && npm install
# unlink any linked per product files
RUN unlink /usr/src/app/server/models
RUN unlink /usr/src/app/server/model-config.json
RUN unlink /usr/src/app/server/config.local.js
# link the correct files in for the product
ENV PRODUCT=roomboss
# RUN cp -Rf /usr/src/app/server/products/$PRODUCT/models /usr/src/app/server/models
# RUN cp -Rf /usr/src/app/server/products/$PRODUCT/model-config.json /usr/src/app/server/models-config.json
# RUN cp -Rf /usr/src/app/server/products/$PRODUCT/config.local.js /usr/src/app/server/config.local.js
COPY server/products/$PRODUCT/models /usr/src/app/server/models
COPY server/products/$PRODUCT/model-config.json /usr/src/app/server/models-config.json
COPY server/products/$PRODUCT/config.local.js /usr/src/app/server/config.local.js
ENV PRODUCT=
# unset product so npm start doesn't try to do stuff with it
RUN ls -lh /usr/src/app/server
ENV ENVIRONMENT=production
EXPOSE 9933 6379
WORKDIR /usr/src/app
CMD ["pm2", "start", "/usr/src/app/process.yml", "--env", "$PRODUCTION", "--no-daemon"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment