Skip to content

Commit

Permalink
Add docker configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
mirromutth committed Sep 5, 2019
1 parent 60f8cfb commit 9e1c6ff
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### MacOS

.DS_Store
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM docker:stable

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# mysql-action
GitHub Action to setup a MySQL database
# MySQL GitHub Action

This [GitHub Action](https://github.com/features/actions) sets up a MySQL database.

## Usage

```yaml
steps:
- uses: mirromutth/mysql-action@v1
with:
mysql password: ${{ secrets.databasePassword }} # Required, the password of the superuser for the specified database
mysql user: 'developer' # Optional, default value is "test", the superuser for the specified database. Of course you can use secrets, too
mysql version: '8.0' # Optional, default value is "latest", the version of the MySQL in Docker
mysql database: 'some_test' # Optional, default value is "test", the specified database which will be create
```
See [Docker Hub](https://hub.docker.com/_/mysql) for available versions.
See [Creating and using secrets (encrypted variables)](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) for hiding database password.
## License
This project is released under the [MIT License](LICENSE).
26 changes: 26 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 'Setup MySQL'
description: 'Setup a MySQL database'
author: 'Mirro Mutth'
branding:
icon: 'database'
color: 'orange'
inputs:
# See https://hub.docker.com/_/mysql for supported versions and further details on input environment variables
mysql version:
description: 'Version of MySQL to use'
required: false
default: 'latest'
mysql database:
description: 'MYSQL_DATABASE - name for the default database that is created'
required: false
default: 'test'
mysql user:
description: 'MYSQL_USER - create the specified user with superuser power for created database'
required: false
default: 'test'
mysql password:
description: 'MYSQL_PASSWORD - superuser password'
required: true
runs:
using: 'docker'
image: 'Dockerfile'
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

docker_run="docker run -e MYSQL_RANDOM_ROOT_PASSWORD=true"
docker_run="$docker_run -e MYSQL_DATABASE=$INPUT_MYSQL_DATABASE"
docker_run="$docker_run -e MYSQL_USER=$INPUT_MYSQL_USER"
docker_run="$docker_run -e MYSQL_PASSWORD=$INPUT_MYSQL_PASSWORD"
docker_run="$docker_run -d -p 3306:3306 mysql:$INPUT_MYSQL_VERSION"

sh -c "$docker_run"

0 comments on commit 9e1c6ff

Please sign in to comment.