summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-10-12 13:21:02 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-10-12 13:21:02 +0200
commit52b9dc29182a06d73e489cc972f932d62a113f24 (patch)
treeae49e9c0aa97b3a0776e098f1472f757c3f621fc
parent4ae44b9b45d14bfcdbe01b6c2cf6df626dc95e0b (diff)
downloadgitlab-ce-52b9dc29182a06d73e489cc972f932d62a113f24.tar.gz
Add Dockerfile templates
-rw-r--r--lib/api/templates.rb3
-rw-r--r--lib/gitlab/template/dockerfile_template.rb30
-rw-r--r--vendor/dockerfile/HTTPd.dockerfile.yml3
3 files changed, 35 insertions, 1 deletions
diff --git a/lib/api/templates.rb b/lib/api/templates.rb
index b9e718147e1..c5dc7f46ebd 100644
--- a/lib/api/templates.rb
+++ b/lib/api/templates.rb
@@ -2,7 +2,8 @@ module API
class Templates < Grape::API
GLOBAL_TEMPLATE_TYPES = {
gitignores: Gitlab::Template::GitignoreTemplate,
- gitlab_ci_ymls: Gitlab::Template::GitlabCiYmlTemplate
+ gitlab_ci_ymls: Gitlab::Template::GitlabCiYmlTemplate,
+ dockerfiles: Gitlab::Template::DockerfileTemplate
}.freeze
helpers do
diff --git a/lib/gitlab/template/dockerfile_template.rb b/lib/gitlab/template/dockerfile_template.rb
new file mode 100644
index 00000000000..d5d3e045a42
--- /dev/null
+++ b/lib/gitlab/template/dockerfile_template.rb
@@ -0,0 +1,30 @@
+module Gitlab
+ module Template
+ class DockerfileTemplate < BaseTemplate
+ def content
+ explanation = "# This file is a template, and might need editing before it works on your project."
+ [explanation, super].join("\n")
+ end
+
+ class << self
+ def extension
+ 'Dockerfile'
+ end
+
+ def categories
+ {
+ "General" => ''
+ }
+ end
+
+ def base_dir
+ Rails.root.join('vendor/dockerfile')
+ end
+
+ def finder(project = nil)
+ Gitlab::Template::Finders::GlobalTemplateFinder.new(self.base_dir, self.extension, self.categories)
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/dockerfile/HTTPd.dockerfile.yml b/vendor/dockerfile/HTTPd.dockerfile.yml
new file mode 100644
index 00000000000..2f05427323c
--- /dev/null
+++ b/vendor/dockerfile/HTTPd.dockerfile.yml
@@ -0,0 +1,3 @@
+FROM httpd:alpine
+
+COPY ./ /usr/local/apache2/htdocs/