Public Repository

Last pushed: 4 months ago
Short Description
Short description is empty for this repo.
Full Description

Dockerfile

FROM mysql:5.5

MAINTAINER Fareoffice <docker@fareoffice.com>

ENV MYSQL_ROOT_PASSWORD setme

# for 'ps' command to work
RUN apt-get update && apt-get install -y procps

# custom config, overrides /etc/mysql/my.cnf
COPY custom.cnf /etc/mysql/conf.d/

# script to import data (looks into /newdata directory)
COPY import.sh /import.sh

# mysql server data directory, feel free to mount a volume here
RUN mkdir -p /data

import.sh

#!/bin/bash

# run me with mounted volume to install new data!
# docker exec <mysql_container_hash> /import.sh

DB_NAME=$1
if [ -z "$DB_NAME" ]; then
  DB_NAME="data"
fi

NEW_DATA=$2
if [ -z "$NEW_DATA" ]; then
  NEW_DATA="/newdata"
fi

cd ${NEW_DATA}
mysql -u root --password=${MYSQL_ROOT_PASSWORD} -e "CREATE DATABASE IF NOT EXISTS ${DB_NAME};"
for file in `find . -name "*.sql" | sed 's,\./,,'`; do
  echo "> "$file
  mysql -u root --password=${MYSQL_ROOT_PASSWORD} ${DB_NAME} < $file
done
Docker Pull Command
Owner
fareoffice