diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f359993 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM ruby:3.1 + +# Move it +WORKDIR /opt +COPY public/ ./public/ +COPY views/ ./views/ +COPY Gemfile . +COPY config.ru . +COPY mywillpower.rb . + +# Dependencies +RUN apt-get update +RUN apt-get -y upgrade +RUN bundle install + +# Environment +EXPOSE 4567 + +# Send it +CMD ["bundle", "exec", "rackup", "-o", "0.0.0.0", "-p", "4567", "-E", \ + "production"] diff --git a/README.md b/README.md index 2cb7021..a80b7e3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,22 @@ Source code for http://mywillpower.org -## Install dependencies +## Local + +### Install dependencies bundle install + +### Run it locally + + bundle exec mywillpower.rb + +## Docker + +### Build + + docker build -t mywillpower . + +### Run + + docker run -p 4567:4567 mywillpower diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..9ff0472 --- /dev/null +++ b/config.ru @@ -0,0 +1,3 @@ +require './mywillpower' + +run Sinatra::Application