This is just a quick overview of how I did it in antibody’s homepage.

antibody home page screenshot

The site has a very simple index.html plus a service that can discover and download the latest antibody version from GitHub releases. Not sure how relevant this is, but the service is written in Go.

Currently, every commit pushed to the master branch of the site repo will be automatically pushed to production. There is no option to skip that.

Let’s see how this can be done using GitHub, CircleCI, Docker and Amazon ElasticBeanstalk.


The very first part of all this process is the Dockerfile. This file describes the software needed to run our service, also how the service is deployed inside it:

FROM alpine:3.2

ENV GOPATH=/gopath \


RUN apk add -U git go && \
  go get -v -d ./... && \
  go get -v && \
  /gopath/bin/rice embed-go -i ./server && \
  go install -v ./... && \
  apk del git go && \
  rm -rf /gopath/src /gopath/pkg /var/cache/apk/*

CMD /gopath/bin/server

As you can see, I get all dependencies, do what I need with them and clean it up, in one single step, just to ensure that the image will be as small as it can, currently, around 20Mb.

Elastic Beanstalk

For the awsebcli to work, after the app is already created, we need a file. Mine looks like this:

  "AWSEBDockerrunVersion": "1",
  "Image": {
    "Name": "caarlos0/getantibody:%BUILD_NUM%",
    "Update": "true"
  "Ports": [
      "ContainerPort": "3000"

Nothing extraordinary here, I just expose the port 3000 and set the image name, which has a %BUILD_NUM% expression in it… but I’ll explain that later.

I put this file inside a .deploy folder. The only thing in that folder is this single file, because awsebcli zips and uploads everything inside the folder you are when you run eb deploy, and we need just that one file.

CircleCI - and the integrations

The circle.yml file must do the following:

  • start the Docker service;
  • install Python - which is needed to install awsebcli;
  • install awsebcli;
  • build the Docker image and push it to Docker Hub;
  • deploy the image to Beanstalk.

That said, mine looks like this: