Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #65 from Amblizer/rails
Browse files Browse the repository at this point in the history
add Ruby on Rails 5 container
  • Loading branch information
Chuxel committed Jun 11, 2019
2 parents 5224ca6 + 13f10c0 commit ce1f043
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 0 deletions.
40 changes: 40 additions & 0 deletions containers/ruby-2-rails-5/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions containers/ruby-2-rails-5/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}
Binary file added containers/ruby-2-rails-5/.npmignore
Binary file not shown.
21 changes: 21 additions & 0 deletions containers/ruby-2-rails-5/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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"],
}
]
}
17 changes: 17 additions & 0 deletions containers/ruby-2-rails-5/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -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"
},
],
}
52 changes: 52 additions & 0 deletions containers/ruby-2-rails-5/README.md
Original file line number Diff line number Diff line change
@@ -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 <kbd>F1</kbd> 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 <kbd>F1</kbd> 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 <kbd>F1</kbd>, 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 <kbd>F5</kbd> to start the project.
6. You should see "* Listening on tcp://0.0.0.0:80" in the Debug Console. Press <kbd>F1</kbd>. 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).

<!-- links -->
[la]: https://code.mzhao.page/
Empty file.

0 comments on commit ce1f043

Please sign in to comment.