Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Building stuffs...

Raja Sundaram zeagord

:shipit:
Building stuffs...
View GitHub Profile
View gist:49038615d5335cb5768685eca405d2d0
View Docker Commands
docker build -t order-service:latest .
docker run -p 9910:8080 order-service:latest
docker images
docker ps # This will give the container id
docker exec -it <container id> /bin/sh
@zeagord
zeagord / node-docker.md
Last active Sep 13, 2019
How to build small Node JS Docker Image and decrease the build time
View node-docker.md

When we were trying to create a docker image for our Node JS based application, we chose to use the official Node docker image (~700MB). On top of that we need to add the node modules, business logic, etc and so on. The final image size was staggering (~1.2GB). It was not what we wanted. Secondly, the average build time to do NPM install and run a grunt task totally took 15 minutes for every build. I am not even talking about the pain of configuring this for different CI/CD pipelines and environments.

The initial docker file was looking something like this:

Initial Docker File

FROM node:6.10.1-alpine
@zeagord
zeagord / CustomRestTemplate.java
Last active May 2, 2018
HttpClientConnection Factory
View CustomRestTemplate.java
@Bean
public ClientHttpRequestFactory createRequestFactory(@Value("${connection.timeout}") String maxConn) {
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
connectionManager.setMaxTotal(maxTotalConn);
connectionManager.setDefaultMaxPerRoute(maxPerChannel);
RequestConfig config = RequestConfig.custom().setConnectTimeout(100000).build();
CloseableHttpClient httpClient = HttpClientBuilder.create().setConnectionManager(connectionManager)
.setDefaultRequestConfig(config).build();
return new HttpComponentsClientHttpRequestFactory(httpClient);
View NoOfStories.java
/**
* Created by rg3 on 10/17/17.
*/
import java.util.ArrayList;
public class NoOfStories {
static int small=1;
static int large=2;
@zeagord
zeagord / UniqueStringTask.java
Last active Oct 17, 2017
Find First Unique String in an Array
View UniqueStringTask.java
import java.util.*;
/**
* Created by rg3 on 10/17/17.
*/
public class UniqueStringTask {
private static String findFirstUnique(String ...names){
if (names.length ==0) { // Check for empty array
@zeagord
zeagord / DockerStorage.md
Last active Apr 17, 2017
How to change the default docker image location in a virtual machine
View DockerStorage.md

PROBLEM

We ran in to a lot of space issues with storing docker images in Azure cloud VMs. Because by default docker images, layers and containers are stored in the

/var/lib/docker

It is the same with the Amazon AWS as well.

The problem with this is most of the virtual machines have a very limited space in the OS Disk and the space can run out very soon. It is wise to save the docker images and attach your data containers to point a mount volume.

You can’t perform that action at this time.