Dockerize your runnable application

Ever run into an issue with environments when running other peoples code? Don’t have the proper modules in your environment? Don’t want to modify your existing environment just to run a CLI program?

Dockerize it! Make the application runnable on any machine using docker. Using a default alpine program date as an example

Step 1: Create a Dockerfile wrapping your application

# Base image
FROM alpine
# Copy your runnable program with the COPY 
# docker command.

# The first argument of the ENTRYPOINT will be command executed when 
# the docker container is run
ENTRYPOINT ["date"] 

Step 2: Build the dockerfile

docker build .

Step: 3 Run the program with docker run

docker run [container-name] -h

Full example

Slack Stats

I wanted an app that showed how often messages in a slack channel were interacted with whether it be from messages in threads or slack reactions. The linked application is a docker program that downloads slack conversations and user information into a database to query for information and statistics.

Tech Stack

  • JavaScript
  • PostgreSQL
  • Docker / Docker Compose

Implementing a Concourse Resource

Felt a few pains using concourse to manage my teams very large testing & release structure. One major pain was the way script dependencies were being used within tasks and jobs. In order to provide consistency with the scripts and programs that all tasks had access to, we would build a docker image with these scripts and executable.

After a while the docker image bloated to a few GB’s in size which wasn’t ideal because every time a task would run for the first time, it would have to pull that large image making pipeline runs slower. Overall it’s probably an anti-pattern; concourse images should have what’s required to run its associated task.

I had a “novel” idea about a custom concourse resource that could download and use executable binaries needed within tasks instead of preloading them into docker images. Source code here

Continue reading