dockerize-stack 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/rails/dockerize_rails.rb +31 -23
- data/lib/rails/templates/{database-docker.yml.erb → config/database-docker.yml.erb} +1 -0
- data/lib/rails/templates/{Dockerfile.erb → docker/development/Dockerfile.erb} +3 -3
- data/lib/rails/templates/docker/development/entrypoint.sh.erb +7 -0
- data/lib/rails/templates/docker-compose.yml.erb +13 -11
- data/lib/rails/templates/dockerignore.erb +17 -1
- data/lib/rails/templates/id_rsa.sample +1 -1
- data/lib/version.rb +1 -1
- metadata +5 -5
- data/lib/rails/templates/entrypoint.sh.erb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b53f448f2fabd4d3ad3ede66b61238759c451ca
|
4
|
+
data.tar.gz: 168e2b581af9dda10ddf43363278c3716f0d7324
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f55ae60e397d0e6cb75a6ae72e39d3b33bff951f0130465b3586ad335b3f905189f625c79e639ba47e87795f18449563b1d1f2c47c3c4d765be1b947a5ee9afc
|
7
|
+
data.tar.gz: 8c3dd9409b7a85a409c96a283aa3266b56b7c54314a192c5828e5e695f1c8e6c2b3e0c8b7efd496c029a7f5a2e5bcc4f09b1ae5ffd758b76c406240553f2286d
|
data/README.md
CHANGED
@@ -11,6 +11,10 @@ This generator help you to have a basic template for your stack; focusing on dev
|
|
11
11
|
```
|
12
12
|
gem install dockerize-stack
|
13
13
|
```
|
14
|
+
or
|
15
|
+
```
|
16
|
+
docker pull devmasx/dockerize-stack
|
17
|
+
```
|
14
18
|
|
15
19
|
## Stacks available
|
16
20
|
|
@@ -24,6 +28,10 @@ gem install dockerize-stack
|
|
24
28
|
```sh
|
25
29
|
dockerize-stack rails
|
26
30
|
```
|
31
|
+
or use docker image
|
32
|
+
```
|
33
|
+
docker run --user $(id -u) -it -v $(pwd):/usr/src devmasx/dockerize-stack rails
|
34
|
+
```
|
27
35
|
|
28
36
|
This script ask you:
|
29
37
|
- Ruby version
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'thor'
|
2
|
-
|
2
|
+
# Ask variables and render templates
|
3
3
|
class DockerizeRails < Thor
|
4
4
|
include Thor::Actions
|
5
|
-
attr_accessor :ruby_version, :database
|
5
|
+
attr_accessor :ruby_version, :database, :id_rsa
|
6
|
+
|
6
7
|
|
7
8
|
def self.source_root
|
8
9
|
File.dirname(__FILE__)
|
@@ -10,29 +11,36 @@ class DockerizeRails < Thor
|
|
10
11
|
|
11
12
|
desc 'generate_files', 'generate docker files for rails application'
|
12
13
|
def generate_files
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
ruby_version = ask('Ruby Version (default 2.5.1):')
|
15
|
+
ruby_version = '2.5.1-slim' if ruby_version == ''
|
16
|
+
database = ask('What is your Database?', limited_to: ['postgresql', 'mysql'])
|
17
|
+
id_rsa = ask('Would you need your id_rsa file to connect with GitHub? Type yes or no (default no):')
|
18
|
+
id_rsa = 'no' if id_rsa == ''
|
19
|
+
render_templates(ruby_version: ruby_version, database: database, id_rsa: id_rsa)
|
20
|
+
end
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
no_commands do
|
23
|
+
def render_templates(ruby_version: '2.5.1-slim', database: 'postgresql', id_rsa: 'no')
|
24
|
+
@ruby_version = ruby_version
|
25
|
+
@database = database
|
26
|
+
@id_rsa = id_rsa
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
template
|
29
|
-
|
30
|
-
|
31
|
-
append_to_file '.gitignore',
|
32
|
-
|
28
|
+
template 'templates/docker/development/Dockerfile.erb', 'docker/development/Dockerfile'
|
29
|
+
template 'templates/docker/development/entrypoint.sh.erb', 'docker/development/entrypoint.sh'
|
30
|
+
template 'templates/docker-compose.yml.erb', 'docker-compose.yml'
|
31
|
+
template 'templates/config/database-docker.yml.erb', 'config/database-docker.yml'
|
32
|
+
template 'templates/dockerignore.erb', '.dockerignore'
|
33
|
+
|
34
|
+
append_to_file '.gitignore', '
|
35
|
+
volumes'
|
36
|
+
if @id_rsa == 'yes'
|
37
|
+
template 'templates/id_rsa.sample', 'id_rsa.sample'
|
38
|
+
append_to_file '.gitignore', '
|
39
|
+
id_rsa'
|
40
|
+
append_to_file '.gitignore', '
|
41
|
+
id_rsa.sample'
|
42
|
+
end
|
43
|
+
puts 'Update your database.yml based in database-docker.yml'
|
33
44
|
end
|
34
|
-
|
35
|
-
puts "Update your database.yml based in database-docker.yml"
|
36
45
|
end
|
37
|
-
|
38
46
|
end
|
@@ -4,7 +4,7 @@ FROM ruby:<%= ruby_version %>
|
|
4
4
|
RUN apt-get update -qq && apt-get install -y \
|
5
5
|
build-essential \
|
6
6
|
libpq-dev \
|
7
|
-
git
|
7
|
+
git
|
8
8
|
|
9
9
|
# install editors
|
10
10
|
RUN apt-get install -y \
|
@@ -38,7 +38,7 @@ RUN apt-get update && apt-get install yarn
|
|
38
38
|
|
39
39
|
RUN mkdir /app
|
40
40
|
WORKDIR /app
|
41
|
-
|
41
|
+
COPY . /app
|
42
42
|
|
43
43
|
<% if @id_rsa == 'yes' %>
|
44
44
|
RUN mkdir /root/.ssh
|
@@ -47,4 +47,4 @@ RUN cp id_rsa /root/.ssh/id_rsa
|
|
47
47
|
RUN touch /root/.ssh/known_hosts
|
48
48
|
RUN eval "$(ssh-agent -s)" && ssh-add ~/.ssh/id_rsa && ssh-add -l && ssh-add -L && echo "Host github.com\n\tIdentityFile ~/.ssh/id_rsa" >> /root/.ssh/config
|
49
49
|
RUN ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts
|
50
|
-
<% end %>
|
50
|
+
<% end %>
|
@@ -1,7 +1,9 @@
|
|
1
1
|
version: '3'
|
2
2
|
services:
|
3
3
|
web:
|
4
|
-
build:
|
4
|
+
build:
|
5
|
+
dockerfile: ./docker/development/Dockerfile
|
6
|
+
context: ./
|
5
7
|
container_name: web
|
6
8
|
stdin_open: true
|
7
9
|
tty: true
|
@@ -32,20 +34,20 @@ services:
|
|
32
34
|
volumes:
|
33
35
|
- ./volumes/postgresql:/var/lib/postgresql/data
|
34
36
|
<% end %>
|
35
|
-
redis:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
mailcatcher:
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
# redis:
|
38
|
+
# image: redis
|
39
|
+
# ports:
|
40
|
+
# - "6379:6379"
|
41
|
+
# mailcatcher:
|
42
|
+
# image: schickling/mailcatcher
|
43
|
+
# ports:
|
44
|
+
# - 1025:1025
|
45
|
+
# - 1080:1080
|
44
46
|
|
45
47
|
# USAGE
|
46
48
|
|
47
49
|
# execute a container for run rails console or rake tasks
|
48
|
-
# docker-compose run web bash
|
50
|
+
# docker-compose run --rm web bash
|
49
51
|
|
50
52
|
# attach the container when use binding.pry
|
51
53
|
# docker attach web
|
@@ -1 +1 @@
|
|
1
|
-
Replace this file with your id_rsa file
|
1
|
+
Replace this file with your id_rsa.pub file
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dockerize-stack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Savignano
|
@@ -36,11 +36,11 @@ files:
|
|
36
36
|
- bin/dockerize-stack
|
37
37
|
- lib/dockerize_stack.rb
|
38
38
|
- lib/rails/dockerize_rails.rb
|
39
|
-
- lib/rails/templates/
|
40
|
-
- lib/rails/templates/database-docker.yml.erb
|
39
|
+
- lib/rails/templates/config/database-docker.yml.erb
|
41
40
|
- lib/rails/templates/docker-compose.yml.erb
|
41
|
+
- lib/rails/templates/docker/development/Dockerfile.erb
|
42
|
+
- lib/rails/templates/docker/development/entrypoint.sh.erb
|
42
43
|
- lib/rails/templates/dockerignore.erb
|
43
|
-
- lib/rails/templates/entrypoint.sh.erb
|
44
44
|
- lib/rails/templates/id_rsa.sample
|
45
45
|
- lib/version.rb
|
46
46
|
homepage: https://github.com/MiguelSavignano/dockerize-stack
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
requirements: []
|
65
65
|
rubyforge_project:
|
66
|
-
rubygems_version: 2.6.
|
66
|
+
rubygems_version: 2.6.14
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: DockerizeStack
|