whitebophir/Dockerfile

27 lines
930 B
Docker
Raw Normal View History

2018-11-26 15:29:11 +00:00
FROM node:10-alpine
WORKDIR /opt/app
ENV PORT=80
RUN touch /usr/bin/start.sh # this is the script which will run on start
# if you need a build script, uncomment the line below
# RUN echo 'sh mybuild.sh' >> /usr/bin/start.sh
# if you need redis, uncomment the lines below
# RUN apk --update add redis
# RUN echo 'redis-server &' >> /usr/bin/start.sh
# daemon for cron jobs
2018-11-28 10:35:27 +00:00
# RUN echo 'echo will install crond...' >> /usr/bin/start.sh
# RUN echo 'crond' >> /usr/bin/start.sh
2018-11-26 15:29:11 +00:00
# Basic npm start verification
RUN echo 'nb=`cat package.json | grep start | wc -l` && if test "$nb" = "0" ; then echo "*** Boot issue: No start command found in your package.json in the scripts. See https://docs.npmjs.com/cli/start" ; exit 1 ; fi' >> /usr/bin/start.sh
RUN echo 'npm install --production' >> /usr/bin/start.sh
# npm start, make sure to have a start attribute in "scripts" in package.json
RUN echo 'npm start' >> /usr/bin/start.sh