瀏覽代碼

initial commit

tags/0.0.1-stable
Daniel 3 年之前
當前提交
8c0a964eab
共有 5 個檔案被更改,包括 148 行新增0 行删除
  1. +29
    -0
      .gitignore
  2. +8
    -0
      Dockerfile
  3. +39
    -0
      README.md
  4. +41
    -0
      contao/composer.json
  5. +31
    -0
      docker-compose.yml

+ 29
- 0
.gitignore 查看文件

@@ -0,0 +1,29 @@
# App config
/app/config/config.yml
/app/config/parameters.yml

# Composer
/.htaccess
/composer.lock
/vendor/

# Contao Manager
/contao-manager/

# Generated folders
/assets/
/files/
/system/*
!/system/config/
/system/config/localconfig.php
/system/config/tcpdf.php
/templates/
/var/
/web/

# Skip files
/system/modules/*/.skip

# Other
/.idea/
/db/

+ 8
- 0
Dockerfile 查看文件

@@ -0,0 +1,8 @@
FROM productionbuild/contao:lts
COPY ./contao/composer.json /var/www/html/contao/composer.json
RUN composer update -d contao && \
composer install -d contao && \
composer dump-autoload -d contao
RUN chown -R www-data:www-data /var/www/html/contao
RUN rm -rf /var/www/html/contao/var/cache/*
EXPOSE 80

+ 39
- 0
README.md 查看文件

@@ -0,0 +1,39 @@
# contao-docker-test

#Installation:
- Go to root folder and create new image named 'spt-docker-contao' via console: `docker build -t spt-docker-contao .`
- After image creation create docker containers: `docker-compose up -d`
- Create a database for contao in database container:
- An easy way to do so is to open up the "Database"-Tab of PhpStorm
- Click on "+" -> Data Source -> MariaDB
- Add a name to configuration e.g. contao-db
- Host: localhost
- Port: 3306
- User: root (according to database-service in docker-compose.yml)
- Password: root (according to database-service in docker-compose.yml)
- Once you're connected go to Query Console (icon at the top "QL") and create the database for contao
- Enter the following line into the console and press the "play"-button to execute the query:
- `CREATE DATABASE contao CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;`
- The database name is free to chose but in this example the database name 'contao' is being used
- Open [contao manager](http://localhost/contao/install) in browser after database creation in order to install contao
- Step through the installation process until you get to enter the database credentials
- NOTE: the 'host' isn't 'localhost' here, use the name of the database service 'database' from the docker-compose.yml
- Finish the installation and have fun :)
- Contao will be available here: [http://localhost/contao](http://localhost/contao)

# Some important information
- The database content is stored in a container which is bind-mounted to the 'db'-folder of the project
- If you should renew your containers, make sure you don't delete this folder,
since all database data is contained in there
- Even if the container will be removed, the database data still exists in this folder and the data will be
provided for the database container through the bind-mounting if you create a new database container
- To enter a container e.g. the contao container run `docker exec -it contao /bin/bash`.
- After this you're directly within the container and can browse through it's content via console.
- If you did changes e.g. in the composer.json on your host machine (your computer - not within a container)
to install or update bundles, then run e.g. `composer install` within the container
- If you do changes on you host machine, these changes will be also available for the container via bind-mounting
- To exit the container, simply run `exit` and you'll get back to the console of your host machine ;)

# Links:
- https://raphaelstaebler.medium.com/run-contao-4-inside-a-docker-container-96422278ea02
- https://github.com/wsargent/docker-cheat-sheet/blob/master/README.md

+ 41
- 0
contao/composer.json 查看文件

@@ -0,0 +1,41 @@
{
"name": "contao/managed-edition",
"type": "project",
"description": "Contao Open Source CMS",
"license": "LGPL-3.0-or-later",
"authors": [
{
"name": "Leo Feyer",
"homepage": "https://github.com/leofeyer"
}
],
"require": {
"php": "^5.6 || ^7.0",
"contao/calendar-bundle": "^4.4",
"contao/comments-bundle": "^4.4",
"contao/conflicts": "@dev",
"contao/faq-bundle": "^4.4",
"contao/listing-bundle": "^4.4",
"contao/manager-bundle": "4.4.*",
"contao/news-bundle": "^4.4",
"contao/newsletter-bundle": "^4.4"
},
"conflict": {
"contao-components/installer": "<1.3",
"contao/core-bundle": "<4.4.8"
},
"extra": {
"branch-alias": {
"dev-4.4": "4.4.x-dev"
},
"contao-component-dir": "assets"
},
"scripts": {
"post-install-cmd": [
"Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication"
],
"post-update-cmd": [
"Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication"
]
}
}

+ 31
- 0
docker-compose.yml 查看文件

@@ -0,0 +1,31 @@
version: '3.1'

services:
database:
image: mariadb
container_name: mariadb
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
volumes:
- ./db:/var/lib/mysql
networks:
- default
contao:
image: spt-docker-contao
container_name: contao
ports:
- "80:80"
volumes:
- ./contao/composer.json:/var/www/html/contao/composer.json
- ./contao/app/config:/var/www/html/contao/app/config
- ./contao/system/config:/var/www/html/contao/system/config
- ./contao/app/Resources:/var/www/html/contao/app/Resources
- ./contao/templates:/var/www/html/contao/templates
- ./contao/files:/var/www/html/contao/files
- ./contao/src:/var/www/html/contao/src
networks:
- default
networks:
default:

Loading…
取消
儲存