FROM mysql:5.7

ARG API_URL

ARG MYSQL_ROOT_PASSWORD 
ARG MYSQL_DATABASE 
ARG MYSQL_USER
ARG MYSQL_PASSWORD

ENV API_URL ${API_URL}

ENV MYSQL_ROOT_PASSWORD ${MYSQL_ROOT_PASSWORD}
ENV MYSQL_DATABASE ${MYSQL_DATABASE}
ENV MYSQL_USER ${MYSQL_USER}
ENV MYSQL_PASSWORD ${MYSQL_PASSWORD}


ADD database/clean-dump.sql /home/dump.sql
RUN sed -i -e 's@API_URL_PLACEHOLDER@'$API_URL'@g' /home/dump.sql && cp /home/dump.sql /docker-entrypoint-initdb.d