Contents of Dockerfile:
FROM scardon/ruby-node-alpine:latest
WORKDIR /opt
COPY ./docker/docker-entrypoint.sh /usr/bin/
RUN apk update \
&& apk add --no-cache --virtual .build_deps \
&& apk add --no-cache --virtual .run_deps python make \
&& gem install slim \
&& npm i -g gulp-cli gulp \
&& apk del .build_deps \
&& chmod +x /usr/bin/docker-entrypoint.sh
EXPOSE 3000
VOLUME [ "/opt" ]
CMD ["docker-entrypoint.sh"]
Contents of docker-entrypoint.sh:
#!/usr/bin/env sh
exec npm i
exec npm run start
When i try to run the container with foreground mode:
docker run --rm -p 3000:3000 -v ~/Sites/app:/opt imagename
It fires npm i
command and exit. How to keep npm run start
in a background, so it will be running all the time.
UPDATED for Patok:
exec node /var/www/project/backend/server.js > /var/log/node-server.log &
exec /usr/sbin/nginx -g "daemon off;"
exec tail -f /var/log/nginx/project.error.log & tail -f /var/log/node-server.log