From 87d63991757d499a0a87a56d548491f807702ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 17 Nov 2019 19:07:07 +0100 Subject: [PATCH] Add Dockerfile. --- .docker/symfony.conf | 33 +++++++++++++++++++++++++++++++++ .dockerignore | 42 ++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 .docker/symfony.conf create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.docker/symfony.conf b/.docker/symfony.conf new file mode 100644 index 00000000..45395c84 --- /dev/null +++ b/.docker/symfony.conf @@ -0,0 +1,33 @@ + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + #ServerName www.example.com + + ServerAdmin admin@localhost + DocumentRoot /var/www/html/public + + + AllowOverride All + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + \ No newline at end of file diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..bd29b3bb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,42 @@ +Dockerfile +docker-compose.yml +.dockerignore +tests/ + +###> symfony/framework-bundle ### +/.env.local +/.env.local.php +/.env.*.local +/public/bundles/ +/var/ +/vendor/ +###< symfony/framework-bundle ### + +###> symfony/phpunit-bridge ### +.phpunit +/phpunit.xml +###< symfony/phpunit-bridge ### + +###> symfony/web-server-bundle ### +/.web-server-pid +###< symfony/web-server-bundle ### + + +.idea/ +.idea/* +uploads/* +###> symfony/webpack-encore-bundle ### +/node_modules/ +/public/build/ +npm-debug.log +yarn-error.log +###< symfony/webpack-encore-bundle ### + +###> liip/imagine-bundle ### +/public/media/cache/ +###< liip/imagine-bundle ### + +###> phpunit/phpunit ### +/phpunit.xml +.phpunit.result.cache +###< phpunit/phpunit ### \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..9f776276 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +FROM php:7-apache + +RUN apt-get update && apt-get install -y curl libcurl4-openssl-dev libicu-dev libpng-dev gnupg zip libzip-dev + +RUN docker-php-ext-install pdo_mysql curl intl mbstring bcmath gd zip + +# Install composer +#RUN curl --silent --show-error https://getcomposer.org/installer | php + +# Install yarn +RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - +RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list +RUN apt-get update && apt-get install -y yarn + +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer +RUN composer global require hirak/prestissimo + +WORKDIR /var/www/html +COPY . . + +# Setup apache2 +RUN a2dissite 000-default.conf +COPY ./.docker/symfony.conf /etc/apache2/sites-available/symfony.conf +RUN a2ensite symfony.conf + +ENV APP_ENV=demo + +RUN composer install -a --no-dev +RUN yarn install && yarn build +RUN php bin/console ckeditor:install --clear=skip + +RUN php bin/console cache:warmup + +# Clean up composer cache +RUN rm -rf /root/.composer +