コード例 #1
0
        public void BuildManifestImage(params string[] platforms)
        {
            if (platforms.Any() == false)
            {
                throw new ArgumentException(
                          $"{nameof( platforms )} can not be empty",
                          nameof(platforms)
                          );
            }

            {
                StringBuilder arguments = new StringBuilder();
                arguments.Append($"manifest create {DockerConstants.ImageName}:latest");
                foreach (string platform in platforms)
                {
                    arguments.Append($" --amend {DockerConstants.GetPlatformImageName( platform )}");
                }

                ProcessArgumentBuilder argumentsBuilder = ProcessArgumentBuilder.FromString(arguments.ToString());
                ProcessSettings        settings         = new ProcessSettings
                {
                    Arguments = argumentsBuilder
                };

                int exitCode = context.StartProcess("docker", settings);
                if (exitCode != 0)
                {
                    throw new ApplicationException(
                              "Error when running docker to build latest manifest image.  Got error: " + exitCode
                              );
                }
            }

            {
                string arguments = $"tag {DockerConstants.ImageName}:latest {DockerConstants.ImageName}:{MedituConstants.Version}";

                ProcessArgumentBuilder argumentsBuilder = ProcessArgumentBuilder.FromString(arguments.ToString());
                ProcessSettings        settings         = new ProcessSettings
                {
                    Arguments = argumentsBuilder
                };

                int exitCode = context.StartProcess("docker", settings);
                if (exitCode != 0)
                {
                    throw new ApplicationException(
                              "Error when running docker to build versioned manifest image.  Got error: " + exitCode
                              );
                }
            }
        }
コード例 #2
0
        public void PushPlatformImage(string platform)
        {
            string arguments = $"push {DockerConstants.GetPlatformImageName( platform )}";
            ProcessArgumentBuilder argumentsBuilder = ProcessArgumentBuilder.FromString(arguments);
            ProcessSettings        settings         = new ProcessSettings
            {
                Arguments = argumentsBuilder
            };

            int exitCode = context.StartProcess("docker", settings);

            if (exitCode != 0)
            {
                throw new ApplicationException(
                          $"Error when trying to push docker platform image {platform}.  Got error: " + exitCode
                          );
            }
        }