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 start
will run webpack-dev-servernpm run build:dev
creates development bundles - non-minified, without hashesnpm run build:prod
creates production bundles