diff --git a/containers/ruby-2-rails-5/.devcontainer/Dockerfile b/containers/ruby-2-rails-5/.devcontainer/Dockerfile new file mode 100644 index 0000000000..7d790fdce7 --- /dev/null +++ b/containers/ruby-2-rails-5/.devcontainer/Dockerfile @@ -0,0 +1,40 @@ +FROM debian:latest + +# Install vim, git, process tools +RUN apt-get update \ + && apt-get install -y \ + vim \ + git \ + procps + +# Install ruby +RUN apt-get install -y \ + ruby \ + ruby-dev \ + build-essential \ + libsqlite3-dev \ + zlib1g-dev \ + libxml2 + +# Install nodejs +RUN apt-get install -y \ + nodejs + +# Install debug tools +RUN gem install \ + rake \ + ruby-debug-ide \ + debase + +# Install sinatra MVC components +RUN gem install \ + rails \ + webdrivers + +# Clean up +RUN apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +# Set the default shell to bash instead of sh +ENV SHELL /bin/bash \ No newline at end of file diff --git a/containers/ruby-2-rails-5/.devcontainer/devcontainer.json b/containers/ruby-2-rails-5/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..3eb1b4e8d1 --- /dev/null +++ b/containers/ruby-2-rails-5/.devcontainer/devcontainer.json @@ -0,0 +1,13 @@ +{ + "name": "Ruby 2 Rails", + "dockerFile": "Dockerfile", + "extensions": [ + "rebornix.Ruby", + ], + "runArgs": [], + // Uncomment the next line if you want to publish any ports. + // "appPort": ["80:80"], + + // Uncomment the next line to run commands after the container is created. + // "postCreateCommand": "cd ${input:projectName} && bundle install" +} \ No newline at end of file diff --git a/containers/ruby-2-rails-5/.npmignore b/containers/ruby-2-rails-5/.npmignore new file mode 100644 index 0000000000..92115a4b18 Binary files /dev/null and b/containers/ruby-2-rails-5/.npmignore differ diff --git a/containers/ruby-2-rails-5/.vscode/launch.json b/containers/ruby-2-rails-5/.vscode/launch.json new file mode 100644 index 0000000000..90f09285e6 --- /dev/null +++ b/containers/ruby-2-rails-5/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Rails App", + "type": "Ruby", + "request": "launch", + // Current dir using env variable input in tasks.json + "cwd": "${workspaceRoot}/test-project", + // run bundle install before rails server + "preLaunchTask": "Create test-project", + "program": "bin/rails", + "postDebugTask": "Delete test-project", + // Setup debug binding IP and port. + "args": ["s", "-b", "0.0.0.0", "-p", "80"], + } + ] +} \ No newline at end of file diff --git a/containers/ruby-2-rails-5/.vscode/tasks.json b/containers/ruby-2-rails-5/.vscode/tasks.json new file mode 100644 index 0000000000..42181c609b --- /dev/null +++ b/containers/ruby-2-rails-5/.vscode/tasks.json @@ -0,0 +1,17 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Create test-project", + "type": "shell", + "command": "rails new test-project -G --skip && cd test-project && bundle install" + }, + { + "label": "Delete test-project", + "type": "shell", + "command": "cd test-project && rm -rf * && rm -f .ruby-version" + }, + ], +} \ No newline at end of file diff --git a/containers/ruby-2-rails-5/README.md b/containers/ruby-2-rails-5/README.md new file mode 100644 index 0000000000..44044a4ba4 --- /dev/null +++ b/containers/ruby-2-rails-5/README.md @@ -0,0 +1,52 @@ +# Ruby 2 Rails 5 + +## Summary + +*Develop Ruby on Rails 5 applications, includes everything you need to get up and running.* + +| Metadata | Value | +|----------|-------| +| *Contributors* | The VS Code Team, [Amblizer][la] | +| *Definition type* | Dockerfile | +| *Languages, platforms* | Ruby | + +## Using this definition with an existing folder + +This definition does not require any special steps to use. Just follow these steps: + +1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine. + +2. To start then: + 1. Start VS Code and open your project folder. + 2. Press F1 select and **Remote-Containers: Create Container Configuration File...** from the command palette. + 3. Select the Ruby 2 rails 5 definition. + +3. To use latest-and-greatest copy of this definition from the repository: + 1. Clone this repository. + 2. Copy the contents of `.devcontainer` and `.vscode` fodlers under `containers/ruby-2-rails-5/` to the root of your project folder. + 3. Start VS Code and open your project folder. + +4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs. + +5. Finally, press F1 and run **Remote-Containers: Reopen Folder in Container** to start using the definition. + +## Testing the definition + +This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps: + +1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine. +2. Clone this repository. +3. Start VS Code, press F1, and select **Remote-Containers: Open Folder in Container...** +4. Select the `containers/ruby-2-rails-5` folder. +5. After the folder has opened in the container, press F5 to start the project. +6. You should see "* Listening on tcp://0.0.0.0:80" in the Debug Console. Press F1. Select **Remote-Containers: Forward Porrt From Container...** then choose **Forward 80**, and by browsing http://localhost/ you should see "Yay! You’re on Rails!". +7. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing. + +## License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE). + + +[la]: https://code.mzhao.page/ \ No newline at end of file diff --git a/containers/ruby-2-rails-5/test-project/.keep b/containers/ruby-2-rails-5/test-project/.keep new file mode 100644 index 0000000000..e69de29bb2