From 8d1b5fc1c95c87a9a8d726cf956771f044e8b231 Mon Sep 17 00:00:00 2001 From: Oleksiy Protas Date: Sat, 15 Oct 2016 08:56:31 +0300 Subject: [PATCH] Docu changes for building Docker images from git --- CHANGELOG.md | 1 + plugins/providers/docker/config.rb | 10 +++++++++- templates/locales/providers_docker.yml | 6 ++++-- website/source/docs/docker/configuration.html.md | 9 +++++++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 981813cab..aeb892839 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -617,6 +617,7 @@ IMPROVEMENTS: - provisioners/puppet: Support custom environment variables [GH-7931, GH-7252, GH-2270] - util/safe_exec: Use subprocess for safe_exec on Windows [GH-7802] - util/subprocess: Allow closing STDIN [GH-7778] + - providers/docker: Support building containter images directly from git BUG FIXES: diff --git a/plugins/providers/docker/config.rb b/plugins/providers/docker/config.rb index b3b6993c6..7ad23908c 100644 --- a/plugins/providers/docker/config.rb +++ b/plugins/providers/docker/config.rb @@ -14,10 +14,18 @@ module VagrantPlugins attr_accessor :build_args # The directory with a Dockerfile to build and use as the basis - # for this container. If this is set, "image" should not be set. + # for this container. If this is set, neither "image" nor "git_repo" + # should be set. # # @return [String] attr_accessor :build_dir + + # The URL for a git repository with a Dockerfile to build and use + # as the basis for this container. If this is set, neither "image" + # nor "build_dir" should be set. + # + # @return [String] + attr_accessor :git_repo # Use docker-compose to manage the lifecycle and environment for # containers instead of using docker directly. diff --git a/templates/locales/providers_docker.yml b/templates/locales/providers_docker.yml index 3fb8ba403..3ad6820a7 100644 --- a/templates/locales/providers_docker.yml +++ b/templates/locales/providers_docker.yml @@ -138,15 +138,17 @@ en: "docker" provider. config: both_build_and_image: |- - Only one of "build_dir" or "image" can be set + Only one of "build_dir", "git_repo" or "image" can be set build_dir_invalid: |- "build_dir" must exist and contain a Dockerfile build_dir_or_image: |- - One of "build_dir" or "image" must be set + One of "build_dir", "git_repo" or "image" must be set compose_configuration_hash: |- "compose_configuration" must be a hash compose_force_vm: |- Docker compose is not currently supported from within proxy VM. + git_repo_invalid: |- + "git_repo" must be a valid git URL create_args_array: |- "create_args" must be an array invalid_link: |- diff --git a/website/source/docs/docker/configuration.html.md b/website/source/docs/docker/configuration.html.md index a72d6d6e0..955c62991 100644 --- a/website/source/docs/docker/configuration.html.md +++ b/website/source/docs/docker/configuration.html.md @@ -15,10 +15,15 @@ you may set. A complete reference is shown below. ### Required * `build_dir` (string) - The path to a directory containing a Dockerfile. - One of this or `image` is required. + One of this, `image` or `git_repo` is required. * `image` (string) - The image to launch, specified by the image ID or a name - such as `ubuntu:12.04`. One of this or `build_dir` is required. + such as `ubuntu:12.04`. One of this, `git_repo` or `build_dir` is required. + + * `git_repo` (string) - The URL of a git repository to build the image from. + Supports pulling specific tags, branches and revision, consult the + [docker documenation](https://docs.docker.com/engine/reference/commandline/build/#/git-repositories) + for more information. One of this, `image` or `build_dir` is required. ### Optional