# Container Name:: nomad
# Copyright (c) 2017 Curse, All Rights Reserved.
#
# Best practices and documentation can be found here:
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
# https://docs.docker.com/engine/reference/builder/

FROM 994136867826.dkr.ecr.us-west-2.amazonaws.com/alpine-dumb-init:3.6.0-1

WORKDIR /usr/local/bin

RUN apk add --no-cache --update wget \
    && wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub \
    && wget -O /glibc.apk https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-2.23-r3.apk \
    && apk add /glibc.apk \
    && rm /glibc.apk \
    && wget https://releases.hashicorp.com/nomad/0.5.6/nomad_0.5.6_linux_amd64.zip \
    && unzip nomad_0.5.6_linux_amd64.zip \
    && rm nomad_0.5.6_linux_amd64.zip \
    && mkdir /data \
    && apk del wget \
    && rm -rfv /var/cache/apk/*

VOLUME ["/data"]
EXPOSE 4646 4647 4648 4648/UDP

ENTRYPOINT ["dumb-init", "nomad"]
CMD ["agent", "-dev"]
