Exemplo n.º 1
0
        private ApiGatewayComponent(DirectoryInfo path, ApiConfiguration configuration, ProjectSettings settings)
        {
            Path           = path;
            _configuration = configuration;
            _settings      = settings;
            _tempPath      = new DirectoryInfo(System.IO.Path.Combine(path.FullName, ".tmp"));

            _dockerContainer = Docker
                               .ContainerFromProject(
                "sam",
                configuration.GetContainerImageName(settings),
                configuration.GetContainerName(settings),
                false)
                               .WithDockerSocket()
                               .Detached()
                               .WithVolume(path.FullName, $"/usr/src/app/{settings.GetRelativePath(path.FullName)}")
                               .WithVolume(System.IO.Path.Combine(_tempPath.FullName, "environment.json"), "/usr/src/app/environment.json")
                               .WithVolume(System.IO.Path.Combine(_tempPath.FullName, "template.yml"), "/usr/src/app/template.yml")
                               .Port(configuration.Settings.Port, 3000);
        }