Last active
August 2, 2017 20:49
-
-
Save double16/81572c74684c18ace981c21042fbc397 to your computer and use it in GitHub Desktop.
Test Vagrant Boxes using Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
working_directory: /home/linux-dev-workstation | |
docker: | |
- image: pdouble16/vagrant-build-base:latest | |
user: root | |
steps: | |
- checkout | |
- setup_remote_docker | |
# The 'test' here is that Vagrant can build the box. We should add more steps after this to ensure the software | |
# we installed is in working order. | |
- run: | |
name: Test Vagrant Up | |
command: | | |
vagrant up --provider docker --provision |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless $::virtual == 'docker' { | |
include virtualbox | |
package { "kernel-devel-${::kernelrelease}": } | |
->Exec<| title == 'vboxdrv' |> | |
} | |
unless $::virtual == 'docker' { | |
package { 'docker': | |
ensure => present, | |
} | |
->service { 'docker': | |
ensure => running, | |
enable => true, | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override.vm.box = nil | |
docker.image = "jdeathe/centos-ssh:centos-7-2.2.3" | |
docker.remains_running = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.vm.provider :docker do |docker, override| | |
override.vm.box = nil | |
override.vm.allowed_synced_folder_types = :rsync | |
docker.image = "jdeathe/centos-ssh:centos-7-2.2.3" | |
docker.name = "linux-dev-workstation" | |
docker.remains_running = true | |
docker.has_ssh = true | |
docker.env = { | |
:SSH_USER => 'vagrant', | |
:SSH_SUDO => 'ALL=(ALL) NOPASSWD:ALL', | |
:LANG => 'en_US.UTF-8', | |
:LANGUAGE => 'en_US:en', | |
:LC_ALL => 'en_US.UTF-8', | |
:SSH_INHERIT_ENVIRONMENT => 'true', | |
} | |
# There is no newline after the existing insecure key, so the new key ends up on the same line and breaks SSH | |
override.ssh.insert_key = false | |
override.ssh.proxy_command = "docker run -i --rm --link linux-dev-workstation alpine/socat - TCP:linux-dev-workstation:22,retry=3,interval=2" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override.vm.allowed_synced_folder_types = :rsync |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker.has_ssh = true | |
docker.env = { | |
:SSH_USER => 'vagrant', | |
:SSH_SUDO => 'ALL=(ALL) NOPASSWD:ALL', | |
:LANG => 'en_US.UTF-8', | |
:LANGUAGE => 'en_US:en', | |
:LC_ALL => 'en_US.UTF-8', | |
:SSH_INHERIT_ENVIRONMENT => 'true', | |
} | |
# There is no newline after the existing insecure key, so the new key ends up on the same line and breaks SSH | |
override.ssh.insert_key = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker.name = "linux-dev-workstation" | |
override.ssh.proxy_command = "docker run -i --rm --link linux-dev-workstation alpine/socat - TCP:linux-dev-workstation:22,retry=3,interval=2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment