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

Commit f5ab366

Browse files
author
Amblizer
committed
add Ruby on Rails 5 container
1 parent df0a246 commit f5ab366

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1298
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM debian:latest
2+
3+
# Install vim, git, process tools
4+
RUN apt-get update \
5+
&& apt-get install -y \
6+
vim \
7+
git \
8+
procps
9+
10+
# Install ruby
11+
RUN apt-get install -y \
12+
ruby \
13+
ruby-dev \
14+
build-essential \
15+
libsqlite3-dev \
16+
zlib1g-dev \
17+
libxml2
18+
19+
# Install nodejs
20+
RUN apt-get install -y \
21+
nodejs
22+
23+
# Install debug tools
24+
RUN gem install \
25+
rake \
26+
ruby-debug-ide \
27+
debase
28+
29+
# Install sinatra MVC components
30+
RUN gem install \
31+
rails \
32+
webdrivers
33+
34+
# Clean up
35+
RUN apt-get autoremove -y \
36+
&& apt-get clean -y \
37+
&& rm -rf /var/lib/apt/lists/*
38+
39+
# Set the default shell to bash instead of sh
40+
ENV SHELL /bin/bash
41+
42+
ENV PROJECT_NAME test-project
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "Ruby 2 Rails",
3+
"dockerFile": "Dockerfile",
4+
"extensions": [
5+
"rebornix.Ruby",
6+
"craigmaslowski.erb"
7+
],
8+
// Uncomment the next line if you want to publish any ports.
9+
// "appPort": ["80:80"],
10+
11+
// Uncomment the next line to run commands after the container is created.
12+
// "postCreateCommand": "cd ${input:projectName} && bundle install"
13+
}
90 Bytes
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Rails App",
9+
"type": "Ruby",
10+
"request": "launch",
11+
// Current dir using env variable input in tasks.json
12+
"cwd": "${workspaceRoot}/${env:PROJECT_NAME}",
13+
// run bundle install before rails server
14+
"preLaunchTask": "bundleInstall",
15+
"program": "bin/rails",
16+
// Setup debug binding IP and port.
17+
"args": ["s", "-b", "0.0.0.0", "-p", "80"],
18+
}
19+
]
20+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{ // 2. bundle install in project folder
7+
"label": "bundleInstall",
8+
"dependsOn": "setEnv", // sequential
9+
"type": "shell",
10+
"command": "cd ${env:PROJECT_NAME} && bundle install"
11+
},
12+
{ // 1. input project name and set as env variable, the only way
13+
// to share it to launch.json. You can also hard code it.
14+
"label": "setEnv",
15+
"type": "shell",
16+
"command": "export PROJECT_NAME=${input:projectName}"
17+
}
18+
],
19+
"inputs": [
20+
{ // prompt user to input project name for debugging
21+
"type": "promptString",
22+
"id": "projectName",
23+
"description": "Please input the name of the project to debug.",
24+
"default": "test-project"
25+
}
26+
]
27+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Ruby 2 Rails 5
2+
3+
## Summary
4+
5+
*Develop Ruby on Rails 5 applications, includes everything you need to get up and running.*
6+
7+
| Metadata | Value |
8+
|----------|-------|
9+
| *Contributors* | The VS Code Team, [Amblizer][la] |
10+
| *Definition type* | Dockerfile |
11+
| *Languages, platforms* | Ruby |
12+
13+
## Using this definition with an existing folder
14+
15+
This definition does not require any special steps to use. Just follow these steps:
16+
17+
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.
18+
19+
2. To start then:
20+
1. Start VS Code and open your project folder.
21+
2. Press <kbd>F1</kbd> select and **Remote-Containers: Create Container Configuration File...** from the command palette.
22+
3. Select the Ruby 2 rails 5 definition.
23+
24+
3. To use latest-and-greatest copy of this definition from the repository:
25+
1. Clone this repository.
26+
2. Copy the contents of `.devcontainer` and `.vscode` fodlers under `containers/ruby-2-rails-5/` to the root of your project folder.
27+
3. Start VS Code and open your project folder.
28+
29+
4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs.
30+
31+
5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.
32+
33+
## Testing the definition
34+
35+
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:
36+
37+
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.
38+
2. Clone this repository.
39+
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
40+
4. Select the `containers/ruby-2-rails-5` folder.
41+
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).
42+
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!".
43+
7. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.
44+
45+
## License
46+
47+
Copyright (c) Microsoft Corporation. All rights reserved.
48+
49+
Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE).
50+
51+
<!-- links -->
52+
[la]: https://code.mzhao.page/
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# If you find yourself ignoring temporary files generated by your text editor
4+
# or operating system, you probably want to add a global ignore instead:
5+
# git config --global core.excludesfile '~/.gitignore_global'
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore the default SQLite database.
11+
/db/*.sqlite3
12+
/db/*.sqlite3-journal
13+
14+
# Ignore all logfiles and tempfiles.
15+
/log/*
16+
/tmp/*
17+
!/log/.keep
18+
!/tmp/.keep
19+
20+
# Ignore uploaded files in development
21+
/storage/*
22+
!/storage/.keep
23+
24+
/node_modules
25+
/yarn-error.log
26+
27+
/public/assets
28+
.byebug_history
29+
30+
# Ignore master key for decrypting credentials and more.
31+
/config/master.key
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby-2.3.3
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
source 'https://rubygems.org'
2+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3+
4+
ruby '2.3.3'
5+
6+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7+
gem 'rails', '~> 5.2.3'
8+
# Use sqlite3 as the database for Active Record
9+
gem 'sqlite3'
10+
# Use Puma as the app server
11+
gem 'puma', '~> 3.11'
12+
# Use SCSS for stylesheets
13+
gem 'sass-rails', '~> 5.0'
14+
# Use Uglifier as compressor for JavaScript assets
15+
gem 'uglifier', '>= 1.3.0'
16+
# See https://github.com/rails/execjs#readme for more supported runtimes
17+
# gem 'mini_racer', platforms: :ruby
18+
19+
# Use CoffeeScript for .coffee assets and views
20+
gem 'coffee-rails', '~> 4.2'
21+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
22+
gem 'turbolinks', '~> 5'
23+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
24+
gem 'jbuilder', '~> 2.5'
25+
# Use Redis adapter to run Action Cable in production
26+
# gem 'redis', '~> 4.0'
27+
# Use ActiveModel has_secure_password
28+
# gem 'bcrypt', '~> 3.1.7'
29+
30+
# Use ActiveStorage variant
31+
# gem 'mini_magick', '~> 4.8'
32+
33+
# Use Capistrano for deployment
34+
# gem 'capistrano-rails', group: :development
35+
36+
# Reduces boot times through caching; required in config/boot.rb
37+
gem 'bootsnap', '>= 1.1.0', require: false
38+
39+
group :development, :test do
40+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
41+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
42+
end
43+
44+
group :development do
45+
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
46+
gem 'web-console', '>= 3.3.0'
47+
gem 'listen', '>= 3.0.5', '< 3.2'
48+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
49+
gem 'spring'
50+
gem 'spring-watcher-listen', '~> 2.0.0'
51+
end
52+
53+
group :test do
54+
# Adds support for Capybara system testing and selenium driver
55+
gem 'capybara', '>= 2.15'
56+
gem 'selenium-webdriver'
57+
# Easy installation and use of chromedriver to run system tests with Chrome
58+
gem 'chromedriver-helper'
59+
end
60+
61+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
62+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

0 commit comments

Comments
 (0)