<p>I am trying to be able to deploy an image from a space repository to AWS EKS. So far I managed to successfully save my docker image to Space. But I stuck at finding a way to upload my image to my cluster.</p>
<p>So far I've created the following to save my docker image to the registy.
Does someone know how I could push this towards AWS EKS? Thank you in advance for taking the time help me!</p>
<pre class="lang-kotlin prettyprint-override"><code>job(&quot;Build Image and save to registry&quot;) {
    startOn {
        gitPush {
            branchFilter {
                +&quot;refs/heads/main&quot;
            }
        }
    }
    
    docker {
        resources {
            cpu = 512
            memory = 1024
        }

        build {
            context = &quot;.&quot;
            file = &quot;Dockerfile&quot;
        }
    
        push(&quot;&lt;my-private&gt;.registry.jetbrains.space/p/repo/repo/image:latest&quot;)
    }
}
</code></pre>

Sir Foo
<p>EDIT: my bad, it turns out I misunderstood the question!</p>
<p>I'm not an AWS guru, but to deploy to a Kubernetes cluster, I believe you would just need an extra step calling <code>kubectl apply -f your-service.yml</code> or something like that.</p>
<hr />
<p>It is not possible out-of-the-box to push to private registries via the <code>docker</code> (now <code>kaniko</code>) top-level DSL, but this DSL is rather legacy.</p>
<p>Instead, use the <a href="https://www.jetbrains.com/help/space/automation-dsl.html#job-host-dockerBuildPush" rel="nofollow noreferrer">dockerBuildPush</a> DSL in a <code>host</code> step (instead of a <code>docker</code>/<code>kaniko</code> step).</p>
<p>One way to login to the private registry is to provide the credentials as secrets to the job (add the secrets in the project settings first) and do a <code>docker login</code> command in a <code>shellScript</code> block before <code>dockerBuildPush</code>:</p>
<pre class="lang-kotlin prettyprint-override"><code>job(&quot;Build Image and save to registry&quot;) {
    startOn {
        gitPush {
            anyBranchMatching {
                +&quot;main&quot;
            }
        }
    }
    
    host {
        env[&quot;REGISTRY_USER&quot;] = &quot;{{ project:registry_user }}&quot;
        env[&quot;REGISTRY_PASS&quot;] = &quot;{{ project:registry_pass }}&quot;
        env[&quot;REGISTRY_URL&quot;] = &quot;{{ project:registry_url }}&quot;
        shellScript {
            content = &quot;docker login -u \$REGISTRY_USER -p \$REGISTRY_PASS \$REGISTRY_URL&quot;
        }
        dockerBuildPush {
            tags {
                +&quot;&lt;my-private&gt;.registry.jetbrains.space/p/repo/repo/image:latest&quot;
            }
        }
    }
}
</code></pre>
<p>As of June 2023, you can now also use the <a href="https://www.jetbrains.com/help/space/automation-dsl.html#job-host-dockerRegistryConnections" rel="nofollow noreferrer">dockerRegistryConnections</a> DSL (but it's not available in the Free plan). In your project settings, you need to go to <code>Docker Registry Connections</code> tab, and add credentials there, and give them a key for reference, e.g. <code>&quot;my-private-registry&quot;</code>. Then you can simply add a <code>dockerRegistryConnections</code> block with a reference to your key, and the worker will login before the step and logout after the step, without the need for manipulating secrets:</p>
<pre class="lang-kotlin prettyprint-override"><code>job(&quot;Build Image and save to registry&quot;) {
    startOn {
        gitPush {
            anyBranchMatching {
                +&quot;main&quot;
            }
        }
    }
    
    host {
        dockerRegistryConnections {
            +&quot;my-private-registry&quot;
        }
        dockerBuildPush {
            tags {
                +&quot;&lt;my-private&gt;.registry.jetbrains.space/p/repo/repo/image:latest&quot;
            }
        }
    }
}
</code></pre>
<p>See <a href="https://www.jetbrains.com/help/space/docker.html#publish-a-docker-image-to-docker-hub" rel="nofollow noreferrer">the documentation</a> for more info.</p>
