Skip to content

Releases: mariotoffia/FluentDocker

2.1.0

25 Apr 19:53
Compare
Choose a tag to compare

With this release it is possible to define Dockerfiles in a fluent API and build them on the fly. It is possible to build new images and create new containers within the same fluent build. This release also comes with support for querying images from the host service.

Checkout the FluentMultiContainerTests to se the build in action:

using (var services = new Builder()
          // Define custom node image to be used
          .DefineImage("mariotoffia/nodetest")
          .ReuseIfAlreadyExists()
          .DefineFrom("ubuntu").Maintainer("Mario Toffia <mario.toffia@gmail.com>")
          .Run("apt-get update &&",
            "apt-get -y install curl &&",
            "curl -sL https://deb.nodesource.com/setup | sudo bash - &&",
            "apt-get -y install python build-essential nodejs")
          .Run("npm install -g nodemon")
          .Add("embedded:Ductus.FluentDockerTest/Ductus.FluentDockerTest.MultiContainerTestFiles/package.txt",
            "/tmp/package.json")
          .Run("cd /tmp && npm install")
          .Run("mkdir -p /src && cp -a /tmp/node_modules /src/")
          .UseWorkDir("/src")
          .Add("index.js", "/src")
          .ExposePorts(8080)
          .Command("nodemon", "/src/index.js").Builder()
          // Redis Db Backend
          .UseContainer().WithName("redis").UseImage("redis").Builder()
          // Node server 1 & 2
          .UseContainer().WithName("node1").UseImage("mariotoffia/nodetest").Link("redis").Builder()
          .UseContainer().WithName("node2").UseImage("mariotoffia/nodetest").Link("redis").Builder()
          // Nginx as load balancer
          .UseContainer().WithName("nginx").UseImage("nginx")
          .Link("node1", "node2").CopyOnStart(nginx, "/etc/nginx/nginx.conf").ExposePort(80).Builder()
          .Build().Start())
        {
          Assert.AreEqual(4, services.Containers.Count);

          var ep = services.Containers.First(x => x.Name == "nginx").ToHostExposedEndpoint("80/tcp");
          Assert.IsNotNull(ep);

          var round1 = $"http://{ep.Address}:{ep.Port}".Wget();
          Assert.AreEqual("This page has been viewed 1 times!",round1);

          var round2 = $"http://{ep.Address}:{ep.Port}".Wget();
          Assert.AreEqual("This page has been viewed 2 times!", round2);
        }

2.0.0

24 Apr 06:28
Compare
Choose a tag to compare

Completely Rewritten to reduce the amount of NuGet packages. As a trade off it now requires docker to be installed on the host that the FluentDocker executes on.

It supports docker-machine, native (Linux) docker, and docker for windows beta. Only tested on window machine though!
On Mac you can in theory both run the beta emulated native and docker machine at the same time (not tested). This dual support do not exist on windows since hyperv and virtualbox cannot coexist on windows.

The design is a three layer design where each layer is extremely thin:

  • Command Layer - static commands to execute against the binaries
    • Resolve docker binaries
    • Execute and parse the responses.
  • Service Layer - thin services representing each entity e.g. machine, container etc.
  • Fluent API - builders to build configuration to create services

This allows for interacting with docker machine and create new docker hosts on the fly and running containers on different machines. Support for explicit drivers such as cloud providers will come at a later stage.