# Container Name:: vicarius
# 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/varnish:6.0.4

ENV BUILD_PACKAGES ruby-dev build-essential
ENV RUNTIME_PACKAGES ruby curl

COPY src/supercronic-linux-amd64 /usr/local/bin/supercronic
COPY src/Gemfile /vicarius/Gemfile
COPY src/Gemfile.lock /vicarius/Gemfile.lock

WORKDIR /vicarius
RUN apt-get update && apt-get install -y --no-install-recommends $BUILD_PACKAGES $RUNTIME_PACKAGES && \
    gem install --no-ri --no-rdoc bundler && bundle install --without test development && \
    apt-get remove -y $BUILD_PACKAGES && apt-get -y autoremove && apt-get clean && \
    rm -rf /var/lib/apt/lists/*

COPY src /vicarius

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/vicarius/run.sh"]

EXPOSE 8080
