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

Commit

Permalink
add Ruby on Rails 5 container
Browse files Browse the repository at this point in the history
  • Loading branch information
Amblizer committed Jun 2, 2019
1 parent df0a246 commit f5ab366
Show file tree
Hide file tree
Showing 78 changed files with 1,298 additions and 0 deletions.
42 changes: 42 additions & 0 deletions containers/ruby-2-rails-5/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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

ENV PROJECT_NAME test-project
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",
"craigmaslowski.erb"
],
// 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.
20 changes: 20 additions & 0 deletions containers/ruby-2-rails-5/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// 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}/${env:PROJECT_NAME}",
// run bundle install before rails server
"preLaunchTask": "bundleInstall",
"program": "bin/rails",
// Setup debug binding IP and port.
"args": ["s", "-b", "0.0.0.0", "-p", "80"],
}
]
}
27 changes: 27 additions & 0 deletions containers/ruby-2-rails-5/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{ // 2. bundle install in project folder
"label": "bundleInstall",
"dependsOn": "setEnv", // sequential
"type": "shell",
"command": "cd ${env:PROJECT_NAME} && bundle install"
},
{ // 1. input project name and set as env variable, the only way
// to share it to launch.json. You can also hard code it.
"label": "setEnv",
"type": "shell",
"command": "export PROJECT_NAME=${input:projectName}"
}
],
"inputs": [
{ // prompt user to input project name for debugging
"type": "promptString",
"id": "projectName",
"description": "Please input the name of the project to debug.",
"default": "test-project"
}
]
}
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. Enter the name of the project to debug at popup input bar (it is populated for the test-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/
31 changes: 31 additions & 0 deletions containers/ruby-2-rails-5/test-project/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore uploaded files in development
/storage/*
!/storage/.keep

/node_modules
/yarn-error.log

/public/assets
.byebug_history

# Ignore master key for decrypting credentials and more.
/config/master.key
1 change: 1 addition & 0 deletions containers/ruby-2-rails-5/test-project/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby-2.3.3
62 changes: 62 additions & 0 deletions containers/ruby-2-rails-5/test-project/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.3.3'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.3'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Loading

0 comments on commit f5ab366

Please sign in to comment.