Updated Dockerfile

Also added instructions for building and deploying Docker image, and added docker directory with custom entrypoint
This commit is contained in:
oldjamey
2018-08-31 14:45:37 -05:00
parent a94ae8dead
commit e0a2566e3a
2 changed files with 35 additions and 2 deletions

View File

@@ -1,8 +1,17 @@
FROM ruby:2.3.1-alpine ###
# Build with 'docker build -t standard_notes_web.img .'
# Run with 'docker run -d -p 127.0.0.1:3000:3000 --name standard_notes_web --restart always standard_notes.img'
# If you need shell access, run 'docker exec -it standard_notes_web /bin/sh'
# Access from http://localhost:3000/
# Set up Nginx to terminate SSL with LetsEncrypt and proxy_pass to http://localhost:3000/
###
FROM ruby:alpine
RUN apk add --update --no-cache \ RUN apk add --update --no-cache \
alpine-sdk \ alpine-sdk \
nodejs \ nodejs \
nodejs-npm \
tzdata tzdata
WORKDIR /app/ WORKDIR /app/
@@ -17,4 +26,10 @@ RUN npm install -g bower grunt
RUN bundle exec rake bower:install RUN bundle exec rake bower:install
RUN grunt RUN npm run build
EXPOSE 3000
ENTRYPOINT [ "./docker/entrypoint" ]
CMD [ "start" ]

18
docker/entrypoint Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env sh
# $0 is a script name,
# $1, $2, $3 etc are passed arguments
# $1 is our command
CMD=$1
case "$CMD" in
'start' )
echo `pwd`
bundle exec rails s -b 0.0.0.0
;;
* )
# Run custom command. Thanks to this line we can still use
# "docker run our_image /bin/sh" and it will work
exec "$@"
;;
esac