FROM alpine:3.9

RUN apk add --no-cache mariadb mariadb-client mariadb-server-utils && \
    rm -f /var/cache/apk/*

## Required by mysql-backup
RUN apk add --no-cache bash gzip && \
    rm -f /var/cache/apk/*

RUN mkdir -p /run/mysqld && \
    chown -R mysql:mysql /run/mysqld

RUN sed -i "s|.*bind-address\s*=.*|bind-address=0.0.0.0|g" /etc/my.cnf.d/mariadb-server.cnf

COPY src/ /

EXPOSE 3306

ENTRYPOINT ["/entrypoint.sh"]