dockerize-stack 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dockerize_stack.rb +6 -0
- data/lib/rails/dockerize_rails.rb +9 -9
- data/lib/react/dockerize_react.rb +42 -0
- data/lib/version.rb +1 -1
- data/{lib/rails/templates → templates/rails}/config/database-docker.yml.erb +0 -0
- data/{lib/rails/templates → templates/rails}/docker-compose.yml.erb +0 -0
- data/{lib/rails/templates → templates/rails}/docker/development/Dockerfile.erb +0 -0
- data/{lib/rails/templates → templates/rails}/docker/development/entrypoint.sh.erb +0 -0
- data/{lib/rails/templates → templates/rails}/docker/kubernetes/scripts/deploy.sh +0 -0
- data/{lib/rails/templates → templates/rails}/docker/kubernetes/scripts/get-secrets.sh +0 -0
- data/{lib/rails/templates → templates/rails}/docker/kubernetes/scripts/remoteconsole.sh +0 -0
- data/{lib/rails/templates → templates/rails}/docker/kubernetes/scripts/set-config-map.sh +0 -0
- data/{lib/rails/templates → templates/rails}/docker/kubernetes/scripts/set-secrets.sh +0 -0
- data/{lib/rails/templates → templates/rails}/docker/kubernetes/scripts/set-services.sh +0 -0
- data/{lib/rails/templates → templates/rails}/docker/kubernetes/scripts/set-workloads.sh +0 -0
- data/{lib/rails/templates → templates/rails}/docker/kubernetes/services/cloudsql-proxy.yaml +0 -0
- data/{lib/rails/templates → templates/rails}/docker/kubernetes/services/rails-nginx.yaml +0 -0
- data/{lib/rails/templates → templates/rails}/docker/kubernetes/workloads/cloudsql-proxy.yaml +0 -0
- data/{lib/rails/templates → templates/rails}/docker/kubernetes/workloads/rails-nginx.yaml +0 -0
- data/{lib/rails/templates → templates/rails}/docker/production/dockerbuild.sh +0 -0
- data/{lib/rails/templates → templates/rails}/docker/production/nginx/Dockerfile +0 -0
- data/{lib/rails/templates → templates/rails}/docker/production/nginx/entrypoint.sh +0 -0
- data/{lib/rails/templates → templates/rails}/docker/production/nginx/etc/nginx/conf.d/default.conf +0 -0
- data/{lib/rails/templates → templates/rails}/docker/production/nginx/etc/nginx/nginx.conf +0 -0
- data/{lib/rails/templates → templates/rails}/docker/production/rails/Dockerfile.erb +0 -0
- data/{lib/rails/templates → templates/rails}/docker/production/rails/entrypoint.sh +0 -0
- data/{lib/rails/templates → templates/rails}/dockerignore.erb +1 -1
- data/templates/react/docker/Dockerfile.erb +23 -0
- data/templates/react/docker/nginx/conf.d/default.conf.template +44 -0
- data/templates/react/dockerignore.erb +27 -0
- metadata +28 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfe36dfc76fc4f7a14199e2497c973eb97b7b47b
|
4
|
+
data.tar.gz: fbf1d1c97d0b81fea077fb21082449154f1c46d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b63a77f1af76cd2286ca344da387021cdb3e460c2c2596793d900298b92c8dee8de1842256a646dcdb956cd4a141dd6d45ec115e8deb3231c383f54aeb87bb46
|
7
|
+
data.tar.gz: a0395469e6bb265c984657cf64df357949f323d59e182e69e4db2e4d55b5f7937f607b0d082aa54db82eb32bc7b2465b2f4b2fcf76ce1b4bec45a08d8f7e1432
|
data/lib/dockerize_stack.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'rails/dockerize_rails'
|
3
|
+
require 'react/dockerize_react'
|
3
4
|
|
4
5
|
module DockerizeStack
|
5
6
|
class Command < Thor
|
@@ -9,5 +10,10 @@ module DockerizeStack
|
|
9
10
|
def rails
|
10
11
|
DockerizeRails.new.generate_files
|
11
12
|
end
|
13
|
+
|
14
|
+
desc 'react', 'generate docker files for create react app'
|
15
|
+
def react
|
16
|
+
DockerizeReact.new.generate_files
|
17
|
+
end
|
12
18
|
end
|
13
19
|
end
|
@@ -7,7 +7,7 @@ class DockerizeRails < Thor
|
|
7
7
|
WORKDIR = ".".freeze
|
8
8
|
|
9
9
|
def self.source_root
|
10
|
-
File.dirname(__FILE__)
|
10
|
+
"#{File.dirname(__FILE__)}/../../templates"
|
11
11
|
end
|
12
12
|
|
13
13
|
desc 'generate_files', 'generate docker files for rails application'
|
@@ -23,19 +23,19 @@ class DockerizeRails < Thor
|
|
23
23
|
|
24
24
|
no_commands do
|
25
25
|
def render_templates
|
26
|
-
template '
|
27
|
-
template '
|
28
|
-
template '
|
29
|
-
template '
|
30
|
-
template '
|
26
|
+
template 'rails/docker/development/Dockerfile.erb', "#{WORKDIR}/docker/development/Dockerfile"
|
27
|
+
template 'rails/docker/development/entrypoint.sh.erb', "#{WORKDIR}/docker/development/entrypoint.sh"
|
28
|
+
template 'rails/docker-compose.yml.erb', "#{WORKDIR}/docker-compose.yml"
|
29
|
+
template 'rails/config/database-docker.yml.erb', "#{WORKDIR}/config/database-docker.yml"
|
30
|
+
template 'rails/dockerignore.erb', "#{WORKDIR}/.dockerignore"
|
31
31
|
puts 'Update your database.yml based in database-docker.yml'
|
32
32
|
end
|
33
33
|
|
34
34
|
def render_production_templates
|
35
|
-
directory '
|
36
|
-
directory '
|
35
|
+
directory 'rails/docker/production', "#{WORKDIR}/docker/production"
|
36
|
+
directory 'rails/docker/kubernetes', "#{WORKDIR}/docker/kubernetes"
|
37
37
|
|
38
|
-
template '
|
38
|
+
template 'rails/docker/production/rails/Dockerfile.erb', "#{WORKDIR}/docker/production/rails/Dockerfile"
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'thor'
|
2
|
+
# Ask variables and render templates
|
3
|
+
class DockerizeReact < Thor
|
4
|
+
include Thor::Actions
|
5
|
+
attr_accessor :nodejs_version
|
6
|
+
|
7
|
+
WORKDIR = ".".freeze
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
"#{File.dirname(__FILE__)}/../../templates"
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'generate_files', 'generate docker files for react create app'
|
14
|
+
def generate_files
|
15
|
+
@nodejs_version = ask_with_default('Nodejs Version (default 10):', '10')
|
16
|
+
|
17
|
+
render_templates
|
18
|
+
end
|
19
|
+
|
20
|
+
no_commands do
|
21
|
+
def render_templates
|
22
|
+
template 'react/docker/Dockerfile.erb', "#{WORKDIR}/docker/Dockerfile"
|
23
|
+
template 'react/dockerignore.erb', "#{WORKDIR}/.dockerignore"
|
24
|
+
directory 'react/docker/nginx', "#{WORKDIR}/docker/nginx"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def ask_with_default(question = '', default = '')
|
31
|
+
result = ask(question)
|
32
|
+
result != '' ? result : default
|
33
|
+
end
|
34
|
+
|
35
|
+
def append_or_create(file_path, file_content)
|
36
|
+
if File.exist?(file_path)
|
37
|
+
append_to_file file_path, file_content
|
38
|
+
else
|
39
|
+
create_file file_path, file_content
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/{lib/rails/templates → templates/rails}/docker/kubernetes/workloads/cloudsql-proxy.yaml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/{lib/rails/templates → templates/rails}/docker/production/nginx/etc/nginx/conf.d/default.conf
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# BUILD STAGE
|
2
|
+
FROM node:10-alpine as build
|
3
|
+
|
4
|
+
#RUN apk -u add git openssh
|
5
|
+
|
6
|
+
WORKDIR /app
|
7
|
+
COPY package.json package-lock.json ./
|
8
|
+
RUN npm ci
|
9
|
+
|
10
|
+
COPY ./src ./src
|
11
|
+
COPY ./public ./public
|
12
|
+
RUN npm run build
|
13
|
+
|
14
|
+
# FINAL STAGE
|
15
|
+
FROM nginx:1.15
|
16
|
+
COPY --from=build /app/build/ /usr/share/nginx/html/
|
17
|
+
COPY docker/nginx/conf.d/default.conf.template /etc/nginx/conf.d/default.conf.template
|
18
|
+
|
19
|
+
ENV PORT=80
|
20
|
+
CMD /bin/bash -c "envsubst < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"
|
21
|
+
|
22
|
+
# docker build -t react-app-production -f docker/Dockerfile .
|
23
|
+
# docker run --rm -p 8080:80 react-app-production
|
@@ -0,0 +1,44 @@
|
|
1
|
+
server {
|
2
|
+
listen ${PORT};
|
3
|
+
server_name localhost;
|
4
|
+
|
5
|
+
#charset koi8-r;
|
6
|
+
#access_log /var/log/nginx/host.access.log main;
|
7
|
+
|
8
|
+
location / {
|
9
|
+
root /usr/share/nginx/html;
|
10
|
+
index index.html index.htm;
|
11
|
+
}
|
12
|
+
|
13
|
+
#error_page 404 /404.html;
|
14
|
+
|
15
|
+
# redirect server error pages to the static page /50x.html
|
16
|
+
#
|
17
|
+
error_page 500 502 503 504 /50x.html;
|
18
|
+
location = /50x.html {
|
19
|
+
root /usr/share/nginx/html;
|
20
|
+
}
|
21
|
+
|
22
|
+
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
23
|
+
#
|
24
|
+
#location ~ \.php$ {
|
25
|
+
# proxy_pass http://127.0.0.1;
|
26
|
+
#}
|
27
|
+
|
28
|
+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
29
|
+
#
|
30
|
+
#location ~ \.php$ {
|
31
|
+
# root html;
|
32
|
+
# fastcgi_pass 127.0.0.1:9000;
|
33
|
+
# fastcgi_index index.php;
|
34
|
+
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
35
|
+
# include fastcgi_params;
|
36
|
+
#}
|
37
|
+
|
38
|
+
# deny access to .htaccess files, if Apache's document root
|
39
|
+
# concurs with nginx's one
|
40
|
+
#
|
41
|
+
#location ~ /\.ht {
|
42
|
+
# deny all;
|
43
|
+
#}
|
44
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
2
|
+
# echo .git > .dockerignore && cat .gitignore >> .dockerignore
|
3
|
+
|
4
|
+
.git
|
5
|
+
Dockerfile
|
6
|
+
|
7
|
+
# dependencies
|
8
|
+
/node_modules
|
9
|
+
/.pnp
|
10
|
+
.pnp.js
|
11
|
+
|
12
|
+
# testing
|
13
|
+
/coverage
|
14
|
+
|
15
|
+
# production
|
16
|
+
/build
|
17
|
+
|
18
|
+
# misc
|
19
|
+
.DS_Store
|
20
|
+
.env.local
|
21
|
+
.env.development.local
|
22
|
+
.env.test.local
|
23
|
+
.env.production.local
|
24
|
+
|
25
|
+
npm-debug.log*
|
26
|
+
yarn-debug.log*
|
27
|
+
yarn-error.log*
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Savignano
|
@@ -36,30 +36,34 @@ files:
|
|
36
36
|
- bin/dockerize-stack
|
37
37
|
- lib/dockerize_stack.rb
|
38
38
|
- lib/rails/dockerize_rails.rb
|
39
|
-
- lib/
|
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
|
43
|
-
- lib/rails/templates/docker/kubernetes/scripts/deploy.sh
|
44
|
-
- lib/rails/templates/docker/kubernetes/scripts/get-secrets.sh
|
45
|
-
- lib/rails/templates/docker/kubernetes/scripts/remoteconsole.sh
|
46
|
-
- lib/rails/templates/docker/kubernetes/scripts/set-config-map.sh
|
47
|
-
- lib/rails/templates/docker/kubernetes/scripts/set-secrets.sh
|
48
|
-
- lib/rails/templates/docker/kubernetes/scripts/set-services.sh
|
49
|
-
- lib/rails/templates/docker/kubernetes/scripts/set-workloads.sh
|
50
|
-
- lib/rails/templates/docker/kubernetes/services/cloudsql-proxy.yaml
|
51
|
-
- lib/rails/templates/docker/kubernetes/services/rails-nginx.yaml
|
52
|
-
- lib/rails/templates/docker/kubernetes/workloads/cloudsql-proxy.yaml
|
53
|
-
- lib/rails/templates/docker/kubernetes/workloads/rails-nginx.yaml
|
54
|
-
- lib/rails/templates/docker/production/dockerbuild.sh
|
55
|
-
- lib/rails/templates/docker/production/nginx/Dockerfile
|
56
|
-
- lib/rails/templates/docker/production/nginx/entrypoint.sh
|
57
|
-
- lib/rails/templates/docker/production/nginx/etc/nginx/conf.d/default.conf
|
58
|
-
- lib/rails/templates/docker/production/nginx/etc/nginx/nginx.conf
|
59
|
-
- lib/rails/templates/docker/production/rails/Dockerfile.erb
|
60
|
-
- lib/rails/templates/docker/production/rails/entrypoint.sh
|
61
|
-
- lib/rails/templates/dockerignore.erb
|
39
|
+
- lib/react/dockerize_react.rb
|
62
40
|
- lib/version.rb
|
41
|
+
- templates/rails/config/database-docker.yml.erb
|
42
|
+
- templates/rails/docker-compose.yml.erb
|
43
|
+
- templates/rails/docker/development/Dockerfile.erb
|
44
|
+
- templates/rails/docker/development/entrypoint.sh.erb
|
45
|
+
- templates/rails/docker/kubernetes/scripts/deploy.sh
|
46
|
+
- templates/rails/docker/kubernetes/scripts/get-secrets.sh
|
47
|
+
- templates/rails/docker/kubernetes/scripts/remoteconsole.sh
|
48
|
+
- templates/rails/docker/kubernetes/scripts/set-config-map.sh
|
49
|
+
- templates/rails/docker/kubernetes/scripts/set-secrets.sh
|
50
|
+
- templates/rails/docker/kubernetes/scripts/set-services.sh
|
51
|
+
- templates/rails/docker/kubernetes/scripts/set-workloads.sh
|
52
|
+
- templates/rails/docker/kubernetes/services/cloudsql-proxy.yaml
|
53
|
+
- templates/rails/docker/kubernetes/services/rails-nginx.yaml
|
54
|
+
- templates/rails/docker/kubernetes/workloads/cloudsql-proxy.yaml
|
55
|
+
- templates/rails/docker/kubernetes/workloads/rails-nginx.yaml
|
56
|
+
- templates/rails/docker/production/dockerbuild.sh
|
57
|
+
- templates/rails/docker/production/nginx/Dockerfile
|
58
|
+
- templates/rails/docker/production/nginx/entrypoint.sh
|
59
|
+
- templates/rails/docker/production/nginx/etc/nginx/conf.d/default.conf
|
60
|
+
- templates/rails/docker/production/nginx/etc/nginx/nginx.conf
|
61
|
+
- templates/rails/docker/production/rails/Dockerfile.erb
|
62
|
+
- templates/rails/docker/production/rails/entrypoint.sh
|
63
|
+
- templates/rails/dockerignore.erb
|
64
|
+
- templates/react/docker/Dockerfile.erb
|
65
|
+
- templates/react/docker/nginx/conf.d/default.conf.template
|
66
|
+
- templates/react/dockerignore.erb
|
63
67
|
homepage: https://github.com/MiguelSavignano/dockerize-stack
|
64
68
|
licenses:
|
65
69
|
- MIT
|