Skip to content

Commit

Permalink
Replace netty with Apache httpclient
Browse files Browse the repository at this point in the history
  • Loading branch information
jkenn99 committed Dec 16, 2024
1 parent 2a5003d commit bbd18a6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
import com.github.dockerjava.api.command.BuildImageCmd;
import com.github.dockerjava.api.command.InspectImageResponse;
import com.github.dockerjava.api.model.AuthConfig;
import com.github.dockerjava.core.DefaultDockerClientConfig;
import com.github.dockerjava.core.DockerClientBuilder;
import com.github.dockerjava.core.DockerClientConfig;
import com.github.dockerjava.core.DefaultDockerClientConfig;
import com.github.dockerjava.core.command.BuildImageResultCallback;
import com.github.dockerjava.core.command.PullImageResultCallback;
import com.github.dockerjava.core.command.PushImageResultCallback;
import com.github.dockerjava.netty.NettyDockerCmdExecFactory;
import com.github.dockerjava.httpclient5.ApacheDockerHttpClient;
import com.github.dockerjava.transport.DockerHttpClient;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.jfrog.build.api.util.Log;
Expand Down Expand Up @@ -74,7 +75,12 @@ public static DockerClient getDockerClient(String host, Map<String, String> envV
}

DockerClientConfig config = configBuilder.build();
return DockerClientBuilder.getInstance(config).withDockerCmdExecFactory(new NettyDockerCmdExecFactory()).build();

DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder()
.dockerHost(config.getDockerHost())
.sslConfig(config.getSSLConfig())
.build();
return DockerClientBuilder.getInstance(config).withDockerHttpClient(httpClient).build();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.jfrog.build.api.multiMap.ListMultimap;
import org.jfrog.build.api.multiMap.Multimap;
import org.jfrog.build.extractor.ci.*;
import org.jfrog.build.extractor.ci.Module;
import org.jfrog.build.extractor.docker.DockerJavaWrapper;
import org.jfrog.build.extractor.executor.CommandExecutor;
import org.jfrog.build.extractor.executor.CommandResults;
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ project('build-info-extractor-docker') {
implementation(group: 'com.github.docker-java', name: 'docker-java', version: dockerJavaVersion) {
exclude group: 'org.glassfish.jersey.core', module: 'jersey-common'
}
implementation group: 'com.github.docker-java', name: 'docker-java-transport-httpclient5', version: dockerJavaVersion
implementation group: 'org.glassfish.jersey.core', name: 'jersey-common', version: jerseyVersion
}
}
Expand Down

0 comments on commit bbd18a6

Please sign in to comment.