Skip to content

Commit 68df86e

Browse files
committed
mirromutth/mysql-action 클론 추가
1 parent 92cc926 commit 68df86e

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed

mysql-action/Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM docker:stable
2+
3+
COPY entrypoint.sh /entrypoint.sh
4+
RUN chmod +x /entrypoint.sh
5+
ENTRYPOINT ["/entrypoint.sh"]

mysql-action/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Mirro Mutth
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

mysql-action/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Copied from https://github.com/mirromutth/mysql-action

mysql-action/action.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: 'Setup MySQL'
2+
description: 'Setup a MySQL database'
3+
author: 'Mirro Mutth'
4+
branding:
5+
icon: 'database'
6+
color: 'orange'
7+
inputs:
8+
host port:
9+
description: 'The port of host'
10+
required: false
11+
default: 3306
12+
container port:
13+
description: 'The port of container'
14+
required: false
15+
default: 3306
16+
character set server:
17+
description: '--character-set-server - The character set of MySQL server'
18+
required: false
19+
default: 'utf8mb4'
20+
collation server:
21+
description: '--collation-server - The character collation of MySQL server'
22+
required: false
23+
default: 'utf8mb4_general_ci'
24+
mysql version:
25+
description: 'Version of MySQL to use'
26+
required: false
27+
default: 'latest'
28+
mysql root password:
29+
description: 'MYSQL_ROOT_PASSWORD - root superuser password'
30+
required: false
31+
default: ''
32+
mysql database:
33+
description: 'MYSQL_DATABASE - name for the default database that is created'
34+
required: false
35+
default: ''
36+
mysql user:
37+
description: 'MYSQL_USER - create the specified user with superuser power for created database'
38+
required: false
39+
default: ''
40+
mysql password:
41+
description: 'MYSQL_PASSWORD - specified superuser password which user is power for created database'
42+
required: false
43+
default: ''
44+
runs:
45+
using: 'docker'
46+
image: 'Dockerfile'

mysql-action/entrypoint.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
docker_run="docker run"
4+
5+
if [ -n "$INPUT_MYSQL_ROOT_PASSWORD" ]; then
6+
echo "Root password not empty, use root superuser"
7+
8+
docker_run="$docker_run -e MYSQL_ROOT_PASSWORD=$INPUT_MYSQL_ROOT_PASSWORD"
9+
elif [ -n "$INPUT_MYSQL_USER" ]; then
10+
if [ -z "$INPUT_MYSQL_PASSWORD" ]; then
11+
echo "The mysql password must not be empty when mysql user exists"
12+
exit 1
13+
fi
14+
15+
echo "Use specified user and password"
16+
17+
docker_run="$docker_run -e MYSQL_RANDOM_ROOT_PASSWORD=true -e MYSQL_USER=$INPUT_MYSQL_USER -e MYSQL_PASSWORD=$INPUT_MYSQL_PASSWORD"
18+
else
19+
echo "Both root password and superuser are empty, must contains one superuser"
20+
exit 1
21+
fi
22+
23+
if [ -n "$INPUT_MYSQL_DATABASE" ]; then
24+
echo "Use specified database"
25+
26+
docker_run="$docker_run -e MYSQL_DATABASE=$INPUT_MYSQL_DATABASE"
27+
fi
28+
29+
docker_run="$docker_run -d -p $INPUT_HOST_PORT:$INPUT_CONTAINER_PORT public.ecr.aws/docker/library/mysql:$INPUT_MYSQL_VERSION --port=$INPUT_CONTAINER_PORT"
30+
docker_run="$docker_run --character-set-server=$INPUT_CHARACTER_SET_SERVER --collation-server=$INPUT_COLLATION_SERVER"
31+
32+
sh -c "$docker_run"

0 commit comments

Comments
 (0)