オープンソースの ERP iDempiere のDocker 版の Docker Compose のサンプルからJPiere9を動かしてみる。
ファイル
- Dockerfile
- compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.7" | |
services: | |
idempiere: | |
build: . | |
volumes: | |
- idempiere_config:/opt/idempiere/configuration | |
- idempiere_plugins:/opt/idempiere/plugins | |
environment: | |
- TZ=Asia/Tokyo | |
ports: | |
- 8080:8080 | |
- 8443:8443 | |
- 12612:12612 | |
depends_on: | |
- postgres | |
postgres: | |
image: postgres:12 | |
volumes: | |
- idempiere_data:/var/lib/postgresql/data | |
environment: | |
- TZ=Asia/Tokyo | |
- POSTGRES_PASSWORD=postgres | |
ports: | |
- 5432:5432 | |
volumes: | |
idempiere_data: | |
idempiere_plugins: | |
idempiere_config: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM idempiereofficial/idempiere:9 | |
# JPiere9のインストールパッケージ | |
ENV JPIERE_BUILD https://osdn.net/frs/redir.php?m=nchc&f=jpiere%2F77250%2FJPiereServer9.Linux.x86_64.zip | |
# JPiere9のダンプファイル | |
ENV JPIERE_DUMPFILE https://osdn.net/frs/redir.php?m=rwthaachen&f=jpiere%2F77250%2FExpDat.jar | |
# JPiere9のインストールパッケージをダウンロードして既存のiDempiereと置き換える | |
RUN wget -q --no-check-certificate "$JPIERE_BUILD" -O /tmp/JPiereServer9.Linux.x86_64.zip && \ | |
echo "Hash: $(md5sum /tmp/JPiereServer9.Linux.x86_64.zip)" > "$IDEMPIERE_HOME/MD5SUMS" && \ | |
echo "Date: $(date)" >> "$IDEMPIERE_HOME/MD5SUMS" && \ | |
unzip -q -o /tmp/JPiereServer9.Linux.x86_64.zip -d /opt && \ | |
# 元のDockerfileでコピーされたファイルをJPiere側に移す | |
cp "$IDEMPIERE_HOME/docker-entrypoint.sh" /opt/jpiere-server && \ | |
cp "$IDEMPIERE_HOME/idempiere-server.sh" /opt/jpiere-server && \ | |
cp "$IDEMPIERE_HOME/MD5SUMS" /opt/jpiere-server && \ | |
# 置き換え | |
rm -rf "$IDEMPIERE_HOME" && mv /opt/jpiere-server "$IDEMPIERE_HOME" && \ | |
# シェルスクリプトの改行コードをLFにし、実行権限を付加 | |
find "$IDEMPIERE_HOME" -name "*.sh" -exec sed -i -e 's/\r//g' {} \; && \ | |
find "$IDEMPIERE_HOME" -name "*.sh" -exec chmod +x {} \; && \ | |
chmod 777 "$IDEMPIERE_HOME/idempiere" && \ | |
# ダウンロードファイル削除 | |
rm -f /tmp/JPiereServer9.Linux.x86_64.zip | |
# JPiere9のダンプファイルをダウンロードし、DBインポートスクリプト内でJPiere9のダンプファイルをインポートするようにする | |
RUN wget -q --no-check-certificate "$JPIERE_DUMPFILE" -O "$IDEMPIERE_HOME/data/seed/ExpDat.jar" && \ | |
sed -i -e "s#jar xvf Adempiere\${SUFFIX}.jar#jar xvf ExpDat.jar\nmv \$IDEMPIERE_HOME/data/seed/ExpDat.dmp \$IDEMPIERE_HOME/data/seed/Adempiere\${SUFFIX}.dmp#" \ | |
"$IDEMPIERE_HOME/utils/RUN_ImportIdempiere.sh" |
イメージを作成して、コンテナ起動
docker compose build
docker compose up
ブラウザから https://localhost:8443/webui/ でアクセス
ユーザー(メールアドレス)とパスワードはJPiere9 のインストール – OSS ERP Compiere Distribution Labから
コンテナ初回起動時、先に PostgreSQL が起動し終える前に、後続の JPiere の DB インポートが行なわれた場合、インストールが失敗するので、その際は分けて起動する
docker compose up postgres -d
# 起動完了を待つ(docker compose logs -f postgresなどで)
docker compose up