From 3a1670ffd4a67801040c74cc4e39367207a24486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20H=C3=A4rtl?= Date: Tue, 14 Nov 2017 12:32:42 +0100 Subject: [PATCH] Ignore var directory and re-create it in Dockerfile --- .dockerignore | 1 + Dockerfile | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.dockerignore b/.dockerignore index b2c763b..a258ccd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,3 +6,4 @@ config/console-local.php runtime/ web/assets/ vendor/ +var/ diff --git a/Dockerfile b/Dockerfile index fb2a175..375133f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -# This is the Dockerfile to build the production image. -# It's not used for local development. - -# Set this to the version of your base image +# Application image +# +# This image adds the application source to the bas image +# FROM yii2-base-myapp:1.0 # Copy apache and PHP configuration for production into the image @@ -11,8 +11,6 @@ COPY ./config/php/productive.ini /usr/local/etc/php/conf.d/productive.ini # Copy the app code into the image COPY . /var/www/html -# The following directories are .dockerignored to not pollute the docker images -# with local logs and published assets from development. So we need to create -# empty dirs and set right permissions inside the container. -RUN mkdir runtime web/assets \ - && chown www-data:www-data runtime web/assets +# Create required directories listed in .dockerignore +RUN mkdir -p runtime web/assets var/session \ + && chown www-data:www-data runtime web/assets var/sessions