0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

テーブル定義書のWEBサイトをコンテナで作成

Posted at

テーブル定義書をコンテナで作成します
※コンテナからDBに接続が出来る必要があります

■Dockerfile

FROM httpd:alpine

# bashを使用する場合はbashをインストールする必要があります
# libxslt は xsltproc を使用するのに必要です
# tzdata は日本時間に変更する場合
RUN apk update \
    && apk add \
        bash \
        mysql-client \
        libxslt \
        tzdata \
    && cp -f /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
    && apk del tzdata

■定義書を作成(shell)

# スキーマ「test_schema 」の定義書を作成します

FILE_INDEX=/usr/local/apache2/htdocs/index.html
FILE_DUMP=/tmp/mysqldump.xml
FILE_TEMPLATE=/tmp/style.xslt

DB_HOST=localhost
DB_NAME=test_schema 
DB_USER=dbuser
DB_PWD=test

MYSQL_PWD=${DB_PWD} mysqldump -h ${DB_HOST}-u ${DB_USER} --no-data --xml ${DB_NAME} > ${FILE_DUMP} \
    && xsltproc -o ${FILE_INDEX} ${FILE_TEMPLATE} ${FILE_DUMP}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?