i need help!
I want to split a dockerfile, so each dockerfile (that build the docker image) has only 1 service!
I know for php and apache there a newer docker images on the docker hub that i will use.
So please help me to split the dockerfile:
FROM phusion/baseimage
VOLUME /srv/myown/htdocs/cms
proposed breaks some php packages (e.g. php-intl)
RUN rm -rf /etc/apt/sources.list.d/proposed.list
phusion/baseimage is not always up to date.
RUN apt-get update &&
apt-get dist-upgrade -y --no-install-recommends
Set Timezone
RUN echo âEurope/Berlinâ > /etc/timezone
RUN dpkg-reconfigure --frontend noninteractive tzdata
A Docker image encapsulates a single service, all its dependencies, configuration items and entry-point script to apply values from env variables to the configuration before the main service is started.
As far as I can see there is ONE main service, which is a php app running in apache having a sqlite database (but why phantomjs?!, screenscrapper? or just for ui-test?).
There is nothing to decompose here. Though, you could aim for âinheritanceâ where you break down your Dockerfile in different intermediate Dockerfiles and reference the previous intermediate image as the base for the next one. I would create a base image with everything up to apache2/php in image. This one should be build that it can be reused. Then put all specifics regargding csm, configuration and the sqlite db into itâs own image, which bases on your apach2/php image.
The granularity is a matter of taste. The question is, if a sequence of commands already results in something that allows reuse of the resulting image. If it doesnât it is not worth building a base image from it.
I want to âsplitâ it because i want to use one Dockerfile for one service only and i want to use the newest one (as example php7, not php5).
So at the end i have a docker image for apache, php7, database an web-app.
Like i said on the docker-hub i can download Apache2 (httpd), PHP7 as docker image with one service in it.
PS: Back to your question⊠the dockerfile isnât from me! phantomjs is used in âthis tool(s)â. And yes this is a (web-)app in php.
Seem like you didnât understand my first post and have everything sorted out already⊠Though, I still stick with âyou have a SINGLE serviceâ. What you consider services, I consider dependencies.
Seperating the database on the other hand can be done, if you start to use a database like mysql, mariadb, postgres that will actualy listen on a port.
My recommendation: start to split the Dockerfile. Gather experience, see what actualy is possible and return in case you get stuck somewhere.
I use nginx, in this project. but the concept is the same
In apache you can use mod_proxy to do the same <FilesMatch "\.php$"> # Unix sockets require 2.4.7 or later SetHandler "proxy:unix:/path/to/app.sock|fcgi://php:9000/" </FilesMatch> https://httpd.apache.org/docs/2.4/mod/mod_proxy.html
Keep in mind that at this time, of this post. that project is far from finished.