FROM ubuntu:16.04

ENV appDir /opt/twitch/carbonapi/current
RUN mkdir -p $appDir
RUN apt-get update && apt-get install -y libcairo2-dev ruby
COPY ./.manta/ $appDir
RUN groupadd -r web && useradd --no-log-init -r -g web web
RUN chown -R web:web $appDir
RUN ls $appDir

USER web
EXPOSE 8000
# TODO: construct config w/ script
ENTRYPOINT cd $appDir && ruby generate-config.rb carbonapi.yaml && $appDir/carbonapi -config ./carbonapi.yaml
