Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View edamico's full-sized avatar

Esteban edamico

View GitHub Profile
@edamico
edamico / init.sh
Created September 19, 2015 16:18
post-docker-init.sh
#!/bin/bash
# we can add any command to be executed whe the container is run
tail -f /dev/null
@edamico
edamico / post.md
Last active August 24, 2016 12:34
post

Docker everything

Many times we need to set up or deploy an application (installing dependencies, dealing with mismatched versions, etc.), and then we need to replicate that work into another server… This situation will annoy us unless we create a sort of agnostic recipe to deal with that problem.. Well, this is where Docker’s magic comes to rescue!

We are using a simple example to show some of the interesting features of Docker. Let’s now suppose that we need to install two Apache Web Servers using different source folders.

Installing the engine

Installing Docker engine is quite easy, we can follow the steps for our specific platform here

Docker components

@edamico
edamico / Dockerfile
Last active September 19, 2015 15:12
Dockerfile post sample
FROM ubuntu
MAINTAINER NaN Labs
# install default aptitude apache2
# try to use the less amount of RUN executions
# to reduce the image binary file
RUN apt-get update && apt-get install -y apache2
# environment variable deployKey will be available
@edamico
edamico / get-source-builder.md
Last active August 29, 2015 14:19
Code related to blog entry
SearchSourceBuilder getSearchSourceBuilder(QueryWrapper queryWrapper) {
   SearchSourceBuilder sourceBuilder = new SearchSourceBuilder()

   if (queryWrapper.query) { 
      sourceBuilder.query(queryWrapper.query)
   }
  
   if (queryWrapper.fields) {
 sourceBuilder.fields(queryWrapper.fields)
object RomanConverter {
val ENTRY_LIST = collection.immutable.List(1 -> "I", 5 -> "V", 10 -> "X", 50 -> "L", 100 -> "C", 500 -> "D", 1000 -> "M").reverse
val ENTRY_MAP = collection.immutable.Map[String, Int]("I" -> 1, "V" -> 5, "X" -> 10, "L" -> 50, "C" -> 100, "D" -> 500, "M" -> 1000)
/**
* Retrieves the number converted to Roman expression
*/
def convertToArabic(roman: String): Int = {