Skip to content

Commit

Permalink
Merge pull request #4391 from m-pyon23/add-docker-compose
Browse files Browse the repository at this point in the history
docker-composeによる環境構築に対応
  • Loading branch information
Kiyotaka Oku authored Nov 25, 2019
2 parents 6c37b65 + 51372d5 commit d48efb0
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ APP_DEBUG=1
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
DATABASE_URL=sqlite:///var/eccube.db
# DATABASE_URL=mysql://dbuser:secret@mysql/eccubedb
# DATABASE_URL=postgresql://postgres/eccubedb?user=dbuser&password=secret

# The version of your database engine
DATABASE_SERVER_VERSION=3
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# For a debug SMTP server, use: "smtp://mailcatcher:1025"
# Delivery is disabled by default via "null://localhost"
MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ RUN if [ ! -f ${APACHE_DOCUMENT_ROOT}/.env ]; then \
cp -p .env.dist .env \
; fi

RUN if [ ! -f ${APACHE_DOCUMENT_ROOT}/var/eccube.db ]; then \
# trueを指定した場合、DBマイグレーションやECCubeのキャッシュ作成をスキップする。
# ビルド時点でDBを起動出来ない場合等に指定が必要となる。
ARG SKIP_INSTALL_SCRIPT_ON_DOCKER_BUILD=false

RUN if [ ! -f ${APACHE_DOCUMENT_ROOT}/var/eccube.db ] && [ ! ${SKIP_INSTALL_SCRIPT_ON_DOCKER_BUILD} = "true" ]; then \
composer run-script installer-scripts && composer run-script auto-scripts \
; fi

Expand Down
77 changes: 77 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
version: "3"

networks:
backend:
driver: bridge

volumes:
pg-database:
driver: local
mysql-database:
driver: local
mailcatcher-data:
driver: local

### ignore folder volume #####
var:
driver: local
vender:
driver: local

services:
### ECCube4 ##################################
ec-cube:
build:
context: .
args:
# ビルド時のECCubeインストールスクリプトをスキップする場合にtrueを指定する。
# ビルド時点でDBサーバの起動や接続が出来ない、という場合等にエラーとなるため。
SKIP_INSTALL_SCRIPT_ON_DOCKER_BUILD: "true"
ports:
- 8080:80
- 4430:443
volumes:
- ".:/var/www/html:cached"
### 同期対象からコストの重いフォルダを除外 #####################
- "var:/var/www/html/var"
- "vender:/var/www/html/vendor"
networks:
- backend

### Postgres ################################
postgres:
image: postgres:10
environment:
- POSTGRES_DB=eccubedb
- POSTGRES_USER=dbuser
- POSTGRES_PASSWORD=secret
ports:
- 15432:5432
volumes:
- pg-database:/var/lib/postgresql/data
networks:
- backend

### MySQL ##################################
mysql:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: eccubedb
MYSQL_USER: dbuser
MYSQL_PASSWORD: secret
volumes:
- mysql-database:/var/lib/mysql
ports:
- 13306:3306
networks:
- backend

### Mailcatcher ##################################
mailcatcher:
image: schickling/mailcatcher
ports:
- "1080:1080"
- "1025:1025"
networks:
- backend
1 change: 1 addition & 0 deletions web.config
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<add sequence="autoload" />
<add sequence="COPYING" />
<add sequence="Dockerfile" />
<add sequence="docker-compose.yml" />
<add sequence=".env" />
<add sequence=".maintenance" />
<add sequence=".htaccess" />
Expand Down

0 comments on commit d48efb0

Please sign in to comment.