Code Monkey home page Code Monkey logo

rails4windocker's Introduction

#rails4windocker: Ruby on Rails on Docker for Windows

This creates a Ruby on Rails development environment that is shared between your Windows 10 desktop and a Docker container running Fedora. Use the bash command-line to administer Rails in a stable Linux environment, while accessing your code through Windows Explorer and the text editor of your choice.

This is a development and testing environment. Don't run it in production - its not secure.

Instructions:

First, get Docker for Windows installed and running. Good luck. - https://docs.docker.com/docker-for-windows/

You will need to go into Docker for Windows Settings to ensure that your current drive is shared.

Now run the following from a cmd shell.

To build the container:

build_image.bat

To run the container on Docker for Windows:

run_container.bat

Next, connect to the container:

connect_to_container.bat

If that worked, you are now in a bash shell on a Docker container.

To install a ruby version 2.4.1 in this environment:

r4wd_init 2.4.1

Ruby 2.4.1 will be installed to the ~/.rbenv/versions/2.4.1 directory on the container, and also in the "ruby" directory under the current Windows directory. You can install as many different Ruby versions as you want.

If .bashrc isn't run automatically for some reason, you may need to do this to get your PATH squared away:

source ~/.bashrc

To let the Linux environment know you want to use ruby version to 2.4.1:

rbenv global 2.4.1

To install rails:

gem install rails

To create a rails app. This will be available on Windows under the current directory's "railsapp" subdirectory.

cd /railsapp
rails new testapp

Run it:

rails server -b 0.0.0.0 -e development

Now open a browser in Windows to connect to 127.0.0.1:3000. You should see the default Rails welcome page.

Things to know:

  • You can make adjustments to paths/image names/whatever in the settings.cmd file in the root directory.
  • The Fedora install running in the Docker should have enough features to run some basic gems, but if you need more tools installed under that environment, use "yum install " at the bash prompt.
  • Keep in mind that your environment will forget these tools if the Docker image is reset.
  • So, any yum installs that you want installed permanently should be added to the Dockerfile, then the docker image should be rebuilt using buildimage.bat.
  • If you need to connect additional shells to a running docker instance, use connect_to_container.bat

rails4windocker's People

Contributors

spikewilliams avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.