FROM fluent/fluentd:edge

USER root

RUN apk add --no-cache --update --virtual .build-deps build-base ruby-dev && \
        apk add mariadb-dev mariadb-connector-c mariadb-connector-c-dev && \
        gem install mysql2 && \
        gem install fluent-plugin-record-modifier && \
        gem install fluent-plugin-sql && \
        gem sources --clear-all && \
        apk del .build-deps && \
        rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem

USER fluent
