Skip to content

Conversation

wedi
Copy link

@wedi wedi commented Oct 7, 2018

This is my take on adding a Dockerfile to Polr.
There are already other approaches and I would like to add one more to the discussion.

In this solution I am using an official and community maintained PHP base image instead of installing everything from scratch. While one could manage to build a smaller image and nginx is said to be more performant than apache, I'd opt for the KISS solution that is easy to maintain and leave all special setups to the individual administrator.

Features:

  • Override Polr's .env configuration with docker environment variables.
  • Multi-stage build to avoid creating loads of layers.
  • Best effort to order everyting in a way that docker build caching helps reducing build time even when Polr source files have changed.
  • AllowOverride None is set and the .htaccess file gets integrated into the apache configuration to increase performance.
  • Most other values are left as is and can get adapted easily to personal needs by mounting custom configuration files into apache's or php's configuration folders.

Try it: https://hub.docker.com/r/wedi42/polr/

I am happy for suggestions to improve the code. Some documentation should be added before a possible merge. I'd just like to discuss this way of solving the task before putting more time into it.

* Uses an official php base image
* Multi-stage build to reduce layers
* Leverages docker build caching
@wedi wedi changed the title Add a Dockerfile Add a Dockerfile (Solution #3) Oct 7, 2018
@driftingaway86
Copy link

Gotta be honest this was what i was trying to build for a personal project. I particularly like the multi-staged build process.

driftingaway86
driftingaway86 previously approved these changes Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants