Exemplo n.º 1
0
        public SolutionComponent(FileInfo path, ProjectSettings settings)
        {
            _path = path;

            _dockerContainer = Docker
                               .ContainerFromImage("mcr.microsoft.com/dotnet/sdk:5.0", $"{settings.GetProjectName()}-dotnet-{Name}")
                               .EntryPoint("dotnet")
                               .WithVolume(path.Directory.FullName, "/usr/local/src", true);
        }
Exemplo n.º 2
0
            public PythonVersion(string version, string runtimeName, string dockerImageTag)
            {
                Version      = version;
                _runtimeName = runtimeName;

                _dockerContainer = Docker
                                   .TemporaryContainerFromImage($"python:{dockerImageTag}")
                                   .EntryPoint("python");
            }
Exemplo n.º 3
0
            public NodeVersion(string version, string runtimeName, string dockerImageTag)
            {
                Version      = version;
                _runtimeName = runtimeName;

                _dockerContainer = Docker
                                   .TemporaryContainerFromImage($"node:{dockerImageTag}")
                                   .EntryPoint("yarn");
            }
Exemplo n.º 4
0
            public GoVersion(string version, string runtimeName, string dockerImageTag)
            {
                Version      = version;
                _runtimeName = runtimeName;

                _dockerContainer = Docker
                                   .TemporaryContainerFromImage($"golang:{dockerImageTag}")
                                   .EntryPoint("go")
                                   .EnvironmentVariable("GOPATH", "/usr/local/src/.go");
            }
Exemplo n.º 5
0
 private ClientComponent(
     DirectoryInfo path,
     ClientConfiguration configuration,
     Docker.Container dockerContainer,
     ProjectSettings settings)
 {
     _path            = path;
     _sourcePath      = new DirectoryInfo(Path.Combine(path.FullName, "src"));
     _configuration   = configuration;
     _dockerContainer = dockerContainer;
     _settings        = settings;
 }
Exemplo n.º 6
0
        private CloudflareWorkerComponent(
            CloudflareWorkerConfiguration configuration,
            DirectoryInfo path,
            ProjectSettings settings)
        {
            _configuration = configuration;
            _path          = path;
            _settings      = settings;

            _dockerContainer = Docker
                               .ContainerFromImage("node", $"{settings.GetProjectName()}-cf-{configuration.Name}")
                               .EntryPoint("yarn")
                               .WithVolume(path.FullName, "/usr/src/app", true)
                               .EnvironmentVariable("DESTINATION_PORT", configuration.Settings.DestinationPort.ToString());

            _watchContainer = _dockerContainer
                              .WithName($"{_dockerContainer.Name}-watcher");
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        private CloudformationStackComponent(
            CloudformationStackConfiguration configuration,
            ProjectSettings settings,
            DirectoryInfo path,
            ProjectSettings projectSettings,
            Components.ComponentTree components)
        {
            _configuration   = configuration;
            _path            = path;
            _projectSettings = projectSettings;
            _components      = components;
            _tempDir         = new DirectoryInfo(Path.Combine(path.FullName, ".tmp"));

            var dataDir = new DirectoryInfo(configuration.GetDataDir(settings));

            if (!dataDir.Exists)
            {
                dataDir.Create();
            }

            var container = Docker
                            .ContainerFromImage(
                $"localstack/localstack:{configuration.Settings.LocalstackVersion}",
                configuration.GetContainerName(projectSettings),
                false)
                            .Detached()
                            .WithVolume(dataDir.FullName, "/tmp/localstack")
                            .WithDockerSocket()
                            .Port(configuration.Settings.MainPort, 8080)
                            .Port(configuration.Settings.ServicesPort, 4566)
                            .EnvironmentVariable("SERVICES", string.Join(",", (configuration.Settings.Services ?? new List <string>())))
                            .EnvironmentVariable("DATA_DIR", "/tmp/localstack/data")
                            .EnvironmentVariable("LAMBDA_REMOTE_DOCKER", "0")
                            .EnvironmentVariable("DEBUG", "1")
                            .EnvironmentVariable("LOCALSTACK_API_KEY", projectSettings.GetConfiguration("localstackApiKey"));

            _dockerContainer = configuration
                               .Settings
                               .PortMappings
                               .Aggregate(container, (current, portMapping) => current.WithArgument($"-p {portMapping}"));
        }