-
Notifications
You must be signed in to change notification settings - Fork 260
How to use Docker CE on Linux with Refuge Restrooms
https://help.github.com/articles/fork-a-repo/
- Ubuntu: https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-engine---community
- Debian: https://docs.docker.com/install/linux/docker-ce/debian/#install-docker-engine---community
- Fedora: https://docs.docker.com/install/linux/docker-ce/fedora/#install-docker-engine---community
- Any Linux: https://docs.docker.com/install/linux/docker-ce/binaries/#install-static-binaries
https://docs.docker.com/compose/install/#install-compose
(Navigate to the Linux tab on this page. Make sure to follow at least Steps 1 and 2 under the Linux tab. Step 1 downloads docker-compose
. Step 2 makes it executable. Step 3 adds handy bash
or zsh
completion.)
Build the container from any terminal program with:
sudo docker-compose build
You can now run the app with:
sudo docker-compose up
The container will be reachable at this address: localhost:3000
(Point your web browser at localhost:3000
or 127.0.0.1:3000
, or even [IP address of computer running the container]:3000
from any computer on the same LAN. The last method is useful for testing the app/site on smart phones and tablets.)
Files are shared between your computer and the Docker machine. If you update a file on your computer, the change should show up on the Docker machine, and vice-versa.
If you need to run commands on the Docker container directly, run this:
sudo docker-compose run web bash
(This will give you a full interactive terminal session running on the Docker machine. You can (for example) run bundle update
to update the Gems in the Gemfile to more recent versions.)
Occasionally, you might need to rebuild the Docker machine so it picks up major updates (such as a new version of Ruby, or an updated Gemfile). To do so, run docker-compose down
and docker-compose build
.
sudo docker-compose run -e "RAILS_ENV=test" web rake db:test:prepare spec
(If you want to know if your changes pass our automated testing, before even submitting your changes to RefugeRestrooms on Github, this will let you know.)
In another terminal window, run:
sudo docker-compose down
(Shutting down the container in this way is safer than exiting with Ctrl + C
or Cmd + C
, and prevents issues with breaking the db
container.)
To clean up encoding problems in the safe2pee data, run (Use rake db:fix_accents[dry_run]
to preview the changes.):
sudo docker-compose run rake db:fixaccents
Please cover any new code with specs. We prefer code to be covered using RSpec or Capybara.
Checkout our Wiki and specifically the newcomers guide.
Please also read our Code of Conduct, which gives guidance on our standards of community and interaction.