Skip to content

Instantly share code, notes, and snippets.

@fkaminski
Created December 19, 2018 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fkaminski/55dd03a5053c81940ebb819f595c30ce to your computer and use it in GitHub Desktop.
Save fkaminski/55dd03a5053c81940ebb819f595c30ce to your computer and use it in GitHub Desktop.
Contao-Docker-Tutorial - Dockerfile
### See: https://hub.docker.com/r/ctsmedia/baseimage-web-php/tags/
FROM ctsmedia/baseimage-web-php:7.2-fpm
MAINTAINER MODIFIED | Original by Daniel Schwiperich | ctsmedia <entwicklung@cts-media.eu>
### Contao Version to install
### Could be overwritten on build like: docker build -t my/contao:4.4.31 --build-arg CONTAO_VERSION=4.4.* .
ARG CONTAO_VERSION=4.4.*
WORKDIR /var/www/share/project
### Set new PHP memory_limit to -1 | default was 512M
### See: https://github.com/ctsmedia/docker-baseimage-web/tree/master/php
### Then: Update PHP Composer
### Default Version 1.6.3 - see https://github.com/ctsmedia/docker-baseimage-web/blob/master/php/Dockerfile
RUN echo memory_limit=-1 > /usr/local/etc/php/conf.d/my-ini.ini \
&& chmod -R 0777 /usr/local/etc/php/conf.d/my-ini.ini \
&& composer selfupdate
### Install Contao
RUN composer create-project contao/managed-edition:$CONTAO_VERSION . \
&& chmod -R 0777 /var/www/composer
### Cleanup tmp dir because contaos post command do some unusal stuff which breaks the system if it was run as root
### https://github.com/contao/core-bundle/blob/master/src/Command/AbstractLockedCommand.php#L32
RUN rm -r /tmp/* \
# Also clean up cache
&& rm -fr var/cache/*
### Install Contao Manager | Orginal named "contao-manager.php" | Set Name back to contao-manager.phar.php
### See: https://github.com/contao/contao-manager/issues/367
RUN curl -o web/contao-manager.phar.php -L https://download.contao.org/contao-manager.phar
### SymLink the console cmd | not used here
#RUN mkdir bin \
# && ln -s ./../vendor/bin/contao-console bin/console
### Make sure everything is writeable also for connected containers.
### It's ok because it's just for local development and not prod use
RUN chmod -R 0777 . \
&& chown -R www-data:www-data .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment