public async Task <bool> CreateContainerDeploymentBundle(CloudApplication cloudApplication, Recommendation recommendation)
        {
            var dockerEngine =
                new DockerEngine.DockerEngine(
                    new ProjectDefinition(recommendation.ProjectPath));

            if (!recommendation.ProjectDefinition.HasDockerFile)
            {
                _interactiveService.LogMessageLine("Generating Dockerfile...");
                dockerEngine.GenerateDockerFile();
            }

            dockerEngine.DetermineDockerExecutionDirectory(recommendation);

            try
            {
                var imageTag = await _deploymentBundleHandler.BuildDockerImage(cloudApplication, recommendation);

                await _deploymentBundleHandler.PushDockerImageToECR(cloudApplication, recommendation, imageTag);
            }
            catch (DockerBuildFailedException ex)
            {
                _interactiveService.LogErrorMessageLine("We were unable to build the docker image due to the following error:");
                _interactiveService.LogErrorMessageLine(ex.Message);
                _interactiveService.LogErrorMessageLine("Docker builds usually fail due to executing them from a working directory that is incompatible with the Dockerfile.");
                _interactiveService.LogErrorMessageLine("You can try setting the 'Docker Execution Directory' in the option settings.");
                return(false);
            }

            return(true);
        }
        public void DockerGenerateConsoleSdkType()
        {
            var projectPath = ResolvePath("ConsoleSdkType");
            var engine      = new DockerEngine.DockerEngine(new ProjectDefinition(projectPath));

            engine.GenerateDockerFile();

            AssertDockerFilesAreEqual(projectPath);
        }
        public void DockerGenerateWebAppDifferentTargetFramework()
        {
            var projectPath = ResolvePath("WebAppDifferentTargetFramework");
            var engine      = new DockerEngine.DockerEngine(new ProjectDefinition(projectPath));

            engine.GenerateDockerFile();

            AssertDockerFilesAreEqual(projectPath);
        }
        public void DockerGenerateWebAppProjectDependencies()
        {
            var projectPath = ResolvePath(Path.Combine("WebAppProjectDependencies", "WebAppProjectDependencies"));
            var engine      = new DockerEngine.DockerEngine(new ProjectDefinition(projectPath));

            engine.GenerateDockerFile();

            AssertDockerFilesAreEqual(projectPath);
        }
        public void DockerGenerateWebAppWithSolutionParentLevel()
        {
            var projectPath = ResolvePath(Path.Combine("WebAppWithSolutionParentLevel", "WebAppWithSolutionParentLevel"));
            var engine      = new DockerEngine.DockerEngine(new ProjectDefinition(projectPath));

            engine.GenerateDockerFile();

            AssertDockerFilesAreEqual(projectPath);
        }
        public void DockerGenerateWebAppNoSolution()
        {
            var projectPath = ResolvePath("WebAppNoSolution");
            var engine      = new DockerEngine.DockerEngine(new ProjectDefinition(projectPath));

            engine.GenerateDockerFile();

            AssertDockerFilesAreEqual(projectPath);
        }
Exemplo n.º 7
0
        public async Task DockerGenerate(string topLevelFolder, string projectName)
        {
            var projectPath = ResolvePath(Path.Combine(topLevelFolder, projectName));

            var fileManager = new FileManager();

            var project = await new ProjectDefinitionParser(fileManager, new DirectoryManager()).Parse(projectPath);

            var engine = new DockerEngine.DockerEngine(project, fileManager);

            engine.GenerateDockerFile();

            AssertDockerFilesAreEqual(projectPath);
        }