Skip to content

Commit

Permalink
chore: MySQLコンテナが起動した際,DBサーバだけでなくSSHサーバも起動するよう変更
Browse files Browse the repository at this point in the history
  • Loading branch information
togawa427 committed Dec 10, 2024
1 parent e22d72a commit 5eaa07a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
FROM mysql:8.4

ADD ./my.cnf /etc/mysql/conf.d/my.cnf
ADD ./hosts /etc/hosts

COPY ./script/init.sh /docker-entrypoint-initdb.d/init.sh
COPY ./my.cnf /etc/mysql/conf.d/my.cnf
COPY ./hosts /etc/hosts
COPY ./script/init.sh /init.sh
COPY ./docker_rsa.pub /root/.ssh/authorized_keys

RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime &&\
chmod 644 /etc/mysql/conf.d/my.cnf &&\
microdnf update &&\
microdnf install -y openssh-server &&\
mkdir -p /run/sshd &&\
ssh-keygen -A
ssh-keygen -A &&\
chmod 744 /init.sh

EXPOSE 33060
EXPOSE 3306
EXPOSE 22

CMD [ "mysqld" ]
CMD [ "./init.sh" ]

3 changes: 2 additions & 1 deletion mysql/script/init.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/usr/sbin/sshd
/usr/sbin/sshd
mysqld

0 comments on commit 5eaa07a

Please sign in to comment.