This image is based on CentOS 7.x which is compatible with Red Hat 7.x. Percona Server for MySQL 5.7 is used as the database server.
Docker workflow is as following:
- Build the kyberia docker image.
- Create a kyberia docker container from the image. No kyberia container is running yet.
- Start the kyberia container. Container can be started at background with no visible console messages, or as an interactive container. You can stop the container in similar way. Stopping the container does not destroy it. You can start it up again. Filesystem changes inside of the container are persistent and visible the next time the container starts.
- At this point, apache and mysql database are running. Kyberia source code directory is shared with the running container. Any change in the source code is visible to the container as well. This is done by docker volume functionality, whereby the source code directory is "mounted" as a volume into the container.
- If necessary, a shell access can be obtained to an already running container.
Building the image requires a database dump, which will be imported while
building. Put kyberia-db.sql into the data directory and build the
image.
Build the kyberia image named kyberia/www:
docker build --rm -t kyberia/www .
From a docker image, you can create multiple containers, which are like an instance of an image. Only one container will be usually needed for kyberia development.
Create the container named kyberia:
mkdir -p mysqld-socket
docker create \
--name kyberia \
-v mysqld-socket:/var/run/mysqld \
-v $PWD:/kyberia \
-e TERM=$TERM -ti kyberia/www
Starting the container is as simple as typing docker start kyberia,
which start the container at background. In order to start it at foreground,
type docker start -ia kyberia
Shell access to an already running container can be obtained by typing
docker exec -ti kyberia zsh -l
.
βββ app
β βββ Resources # twig templates & main.js for JS assets
β βββ config # config related to building & bundling (webpack, doctrine, Symfony)
βββ bin # TBD
βββ data # folder that contains initial SQL dump
βββ docker # config files for docker images
βββ mysqld-socket # TBD
βββ node_modules # (downloaded) JS dependencies via npm/yarn
βββ src # source code
βββ tests # source code tests
βββ var # TBD
β βββ cache # (populated in runtime)
β βββ logs # (populated in runtime)
β βββ sessions # (populated in runtime)
βββ vendor # (downloaded) PHP depdendencies via composer
βββ web # www ROOT
βββ css # Webpack output - styles: main + vendor
βββ fonts # Webpack output - fonts
βββ images # Webpack output - referenced images
βββ js # Webpack output - JavaScript: - main + vendor
- this projects uses Webpack2 loading & bundling front-end assets (js, css, fonts, images, etc)
- outputs bundles to destination directory
<rootDir>/web+ folder based on bundle type - 3 profiles
npm startwill run webpack-dev-servernpm run build:devcreates development bundles - non-minified, without hashesnpm run build:prodcreates production bundles