local-development.mysql-Dockerfile Maven / Gradle / Ivy
The newest version!
# syntax=docker/dockerfile:latest
# Using this docker compose file to store all the configuration and setting needed to build a local database in docker.
# This database server will be used to be used to simulate the RDS on AWS for testing.
# Reference: https://hub.docker.com/_/mysql
# Create the docker image with the following command:
# docker build . --file ./mysql-Dockerfile --tag expense-tally/em-db:latest
ARG mysql_version=5.7
FROM mysql:${mysql_version}
# This variable is mandatory and specifies the password that will be set for the MySQL root superuser account.
ENV MYSQL_ROOT_PASSWORD=Password1
# This variable is optional and allows you to specify the name of a database to be created on image startup. If a user/
# password was supplied (see below) then that user will be granted superuser access (corresponding to GRANT ALL) to this
# database.
ENV MYSQL_DATABASE=expense_manager
# These variables are optional, used in conjunction to of a new user and to set that user's password. This user will
# be granted superuser permissions (see above) for the database specified by the MYSQL_DATABASE variable. Both variables
# are required for a user to be created.
ENV MYSQL_USER=expensetally
ENV MYSQL_PASSWORD=Password1
RUN apt update;
RUN apt install apt-utils --assume-yes;
RUN apt-get --verbose-versions --assume-yes dist-upgrade;
RUN apt-get --assume-yes autoremove;
RUN apt-get --assume-yes autoclean;
# Add the content of the sql-scripts/ directory to your image
# All scripts in docker-entrypoint-initdb.d/ are automatically
# executed during container startup
COPY expense_manager.sql /docker-entrypoint-initdb.d/