FROM phusion/baseimage:0.9.17

ENV RUNTIME=DOCKER
ENV DATA_PATH=/home/scream/var

# Expose HTTP port
EXPOSE 5000

# unelevated user
RUN useradd --create-home scream

# Golang compilers
RUN cd /usr/local && wget https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz && \
    tar xf go1.5.1.linux-amd64.tar.gz && rm go1.5.1.linux-amd64.tar.gz

# install gb
RUN mkdir /go && GOPATH=/go go get github.com/constabulary/gb/... \
 && cp /go/bin/gb /usr/bin/gb

# Add application code and build
ADD . /app
RUN cd /app && gb build all

# Run
CMD /sbin/my_init
