Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

MySQL - populate the pipelines database with your tables and schema

Misha Shirman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 12, 2018

When it comes to initializing mysql database (on a service container), the documentation refers to the official docker hub MySQL page. Normally one would start a container and mount host volume with init .sql files that would be picked up by docker container and ran from mounted volume /docker-entrypoint-initdb.d.

I hit the wall trying to figure out how to this in the context of the bitbucket-pipelines.yml.

Any help would be greatly appreciated!

- Michael

1 answer

1 vote
MB
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 12, 2018

In your pipeline, you could do the following;

  1. In your pipeline, create a Dockerfile from the MySQL base image, and copy your .sql or .sh scripts to the entrypoint
  2. Build and Push the image to a registry of your choice ( ie private, local, google container registry etc )
  3. Use service definitions in pipelines to use the image you pushed containing your .sql
  4. Parse environment variables to the service definition such as MYSQL_DATABASE, MY_SQLPASSWORD etc

Some more details on definitions can be found here

Misha Shirman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 13, 2018

Thank you Max!

I though i would need to go this route, but wanted to keep the build times to a minimum. Thinking maybe we will maintain our custom db container separately and use it for the test step as a service. So that we don't have to build/push/pull a service container while building the app.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events