Skip to content

Commit d68f59c

Browse files
committed
add db/startupservice.sh to initialize db
1 parent d1e2e2f commit d68f59c

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

db/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ RUN mkdir -p /run/sshd
3030

3131
# Expose SSH port
3232
EXPOSE 22
33+
EXPOSE 3306
3334

34-
# Start SSH service
35-
CMD ["/usr/sbin/sshd", "-D"]
35+
# Add mariadb service startup script
36+
COPY ./db/startupservice.sh /startupservice.sh
37+
RUN chmod +x /startupservice.sh
3638

39+
ENTRYPOINT ["/startupservice.sh"]
40+
CMD ["mariadbd"]

db/startupservice.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -o errexit
3+
set -o nounset
4+
5+
# https://en.wikipedia.org/wiki/ANSI_escape_code
6+
E0="$(printf "\e[0m")" # reset
7+
E1="$(printf "\e[1m")" # bold
8+
9+
echo "${E1}Starting mariadb: http://127.0.0.1:3306${E0}"
10+
11+
# Start mariadb in the background
12+
docker-entrypoint.sh "$@"
13+
14+
# Start SSH service
15+
/usr/sbin/sshd -D

0 commit comments

Comments
 (0)