mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Updated docker stuff
This commit is contained in:
28
Dockerfile
28
Dockerfile
@@ -1,28 +0,0 @@
|
|||||||
FROM ruby:2.2.2
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get upgrade -y && apt-get install -y build-essential
|
|
||||||
RUN apt-get install -y nodejs sqlite3
|
|
||||||
|
|
||||||
ENV APP_HOME /wrestlingApp
|
|
||||||
ENV PORT 3000
|
|
||||||
|
|
||||||
RUN mkdir $APP_HOME
|
|
||||||
|
|
||||||
WORKDIR $APP_HOME
|
|
||||||
|
|
||||||
ADD Gemfile* $APP_HOME/
|
|
||||||
RUN bundle install
|
|
||||||
|
|
||||||
ADD . $APP_HOME
|
|
||||||
|
|
||||||
RUN rake db:drop
|
|
||||||
RUN rake db:migrate RAILS_ENV=test
|
|
||||||
RUN rake db:migrate RAILS_ENV=development
|
|
||||||
RUN rake db:seed
|
|
||||||
RUN rake assets:precompile
|
|
||||||
RUN rake test
|
|
||||||
|
|
||||||
#CMD rails s puma --binding 0.0.0.0
|
|
||||||
CMD bundle exec passenger start -p $PORT --max-pool-size 3
|
|
||||||
|
|
||||||
EXPOSE 3000
|
|
||||||
@@ -22,11 +22,9 @@ Development details:
|
|||||||
|
|
||||||
Docker instructions:
|
Docker instructions:
|
||||||
|
|
||||||
* Building the image <tt>docker build -t wrestling .</tt>
|
* Building and run the image: <tt>bash rails-dev.sh wrestlingapp</tt> This will mount your local directory to /rails inside the container and will open port 3000 to port 3000 on your local machine.
|
||||||
|
|
||||||
* Running the image (as development) <tt>docker run -it --rm -p 3000:3000 wrestling</tt>
|
* After running the above script, you'll be presented a shell. You'll need to run <tt>bash rails-dev-db.sh</tt> to set up the development db's. After those are set up, you can run <tt>rake test</tt> to run the tests or <tt>rails s -b 0.0.0.0</tt> to run a development server. You can also run any other rails commands from here.
|
||||||
|
|
||||||
* Developing in docker by mapping your work directory <tt>docker run -it -p 3000:3000 -v /Your/path/to/wrestlingApp:/wrestlingApp --rm wrestling /bin/bash</tt>
|
|
||||||
|
|
||||||
What the app does now:
|
What the app does now:
|
||||||
|
|
||||||
|
|||||||
20
rails-dev-Dockerfile
Normal file
20
rails-dev-Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
FROM ruby:2.2.3
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get -y upgrade
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get upgrade -y && apt-get install -y build-essential
|
||||||
|
RUN apt-get install -y nodejs sqlite3
|
||||||
|
|
||||||
|
RUN gem install --no-rdoc --no-ri bundler
|
||||||
|
RUN mkdir /rails
|
||||||
|
WORKDIR /rails
|
||||||
|
VOLUME ["/rails"]
|
||||||
|
|
||||||
|
ADD Gemfile* /rails/
|
||||||
|
RUN bundle install --without production
|
||||||
|
ADD . /rails/
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD /bin/bash
|
||||||
2
rails-dev-db.sh
Executable file
2
rails-dev-db.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
rake db:setup
|
||||||
|
rake db:migrate RAILS_ENV=test
|
||||||
11
rails-dev.sh
Executable file
11
rails-dev.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
if [ $# != 1 ]; then
|
||||||
|
echo "Please enter docker image name for the rails development environment"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
APPPATH="$(pwd)"
|
||||||
|
|
||||||
|
docker build -t $1 -f rails-dev-Dockerfile .
|
||||||
|
docker run -it -p 3000:3000 -v ${APPPATH}:/rails $1 /bin/bash
|
||||||
Reference in New Issue
Block a user