Vagrant 做 Docker 机器的测试环境

下载用例

1
$ git clone https://github.com/vfarcic/books-ms.git

启动虚拟机

1
2
$ cd books-ms
$ vagrant up dev

测试虚拟机安装

1
2
3
4
5
6
7
$ vagrant ssh dev

> ansible --version
> docker --version
> docker-compose --version

> cd /vagrant && ls -la

下载容器依赖

1
> sudo docker pull vfarcic/books-ms-tests

开启 docker 容器

1
2
3
4
5
6
7
8
> sudo docker run -it --rm \
-v $PWD/client/components:/source/client/components \
-v $PWD/client/test:/source/client/test \
-v $PWD/src:/source/src \
-v $PWD/target:/source/target \
-p 8080:8080 \
--env TEST_TYPE=watch-front \
vfarcic/books-ms-tests

测试

1
2
> sudo docker-compose -f docker-compose-dev.yml run feTestslocal
> sudo docker-compose -f docker-compose-dev.yml run testslocal

退出 & 关闭虚拟机

1
2
> exit
$ vagrant halt dev
Donate - Support to make this site better.
捐助 - 支持我让我做得更好.