FROM mhart/alpine-node:7.8

MAINTAINER Oyst <tech@oyst.com>
ARG NPM_TOKEN
ENV CONSUL_TEMPLATE_VERSION 0.18.5

ADD https://releases.hashicorp.com/consul-template/${CONSUL_TEMPLATE_VERSION}/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip /

RUN apk update \
 && apk add git \
 && mkdir -p /app \
 && unzip /consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip -d /usr/local/bin \
 && rm -rf /consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip

WORKDIR /app
COPY . /app
COPY .npmrc /app/.npmrc

RUN ./bin/set_npmrc && npm install --quiet --unsafe-perm=true \
 && apk del --purge git

RUN rm -f /app/.npmrc

CMD ["./bin/start"]

EXPOSE 8080
