Sign inSign up

ardhendushekhar/vprofiledb

By ardhendushekhar

•Updated almost 3 years ago

Database layer for Vprofile Application Stack

Image
Databases & storage
0

120

ardhendushekhar/vprofiledb repository overview

⁠MySQL Database for VProfile Project

⁠Overview

This Docker image sets up a MySQL 8.0.33 database server pre-configured for the VProfile project. It includes an initial database and schema setup from a provided SQL backup file. This image is intended to streamline the deployment process of the VProfile project by providing a ready-to-use database server.

⁠Image Details

  • Base Image: mysql:8.0.33
  • Author: Ardhendu Shekhar
  • Project: Vprofile-Containerization
  • Environment Variables:
    • MYSQL_ROOT_PASSWORD: Root password for MySQL
    • MYSQL_DATABASE: Name of the initial database
  • SQL Backup File: db_backup.sql
  • Port Exposed: 3306

⁠Usage

⁠Pulling the Image

To pull the Docker image from DockerHub:

docker pull your-dockerhub-username/vprofile-mysql
⁠Running the Container

To run the Docker container:

docker run -d -p 3306:3306 \
  -e MYSQL_ROOT_PASSWORD=Root password for MySQL \
  -e MYSQL_DATABASE=accounts \
  ardhendushekhar/vprofiledb:latest

This command will start a MySQL database container with the specified root password and initial database, accessible at localhost:3306.

⁠Docker Compose

For integrating this MySQL database with other services, you can use Docker Compose. Below is an example docker-compose.yml:

version: '3'
services:
  mysql:
    image: mysql:8.0.33
    environment:
      MYSQL_ROOT_PASSWORD: Root password for MySQL
      MYSQL_DATABASE: Name of the initial database
    ports:
      - "3306:3306"

Run with:

docker-compose up -d
⁠Customizing the Environment Variables

You can customize the environment variables to match your requirements:

  • MYSQL_ROOT_PASSWORD: Set this to your desired root password.
  • MYSQL_DATABASE: Set this to the name of the database you want to create.

Example:

docker run -d -p 3306:3306 \
  -e MYSQL_ROOT_PASSWORD=mynewpassword \
  -e MYSQL_DATABASE=mydatabase \
  ardhendushekhar/vprofiledb:latest

⁠Initialization

When the container is started for the first time, the contents of the db_backup.sql file will be used to initialize the database. This file should contain the SQL commands to set up the database schema and populate it with initial data.

⁠Building the Image Locally

If you want to build the Docker image locally:

  1. Create a db_backup.sql file with your database schema and initial data.

  2. Create a Dockerfile:

    FROM mysql:8.0.33
    LABEL "Author"="Ardhendu Shekhar"
    LABEL "Project"="Vprofile-Containerization"
    
    ENV MYSQL_ROOT_PASSWORD=""
    ENV MYSQL_DATABASE=""
    
    ADD db_backup.sql /docker-entrypoint-initdb.d
    
    EXPOSE 3306
    
  3. Build the Docker image:

    docker build -t your-dockerhub-username/vprofile-mysql .
    
  4. Run the Docker container:

    docker run -d -p 3306:3306 \
      -e MYSQL_ROOT_PASSWORD=""\
      -e MYSQL_DATABASE=""\
      your-dockerhub-username/vprofile-mysql
    

⁠Contributing

If you wish to contribute to this project, please follow these steps:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/YourFeature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin feature/YourFeature).
  5. Create a new Pull Request.

This Docker image simplifies the setup and deployment of a MySQL database for the VProfile project, ensuring a consistent environment and reducing setup time. Enjoy developing and deploying your applications with ease!

Tag summary

Content type

Image

Digest

sha256:97e813a5a…

Size

158 MB

Last updated

almost 3 years ago

docker pull ardhendushekhar/vprofiledb