FROM vladgen/yii2-apache-php7-bcm-gd-r-gcs #our custom apache2 conf, e.g. port COPY app_engine/apache2.conf /etc/apache2/ # Copy the working dir to the image's web root COPY . /var/www/html COPY ./frontend /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 /var/www/html/frontend/web/files RUN if [ ! -d "frontend/runtime" ]; then mkdir frontend/runtime; fi && \ chown www-data:www-data frontend/runtime RUN if [ ! -d "frontend/web" ]; then mkdir frontend/web; fi && \ chown www-data:www-data frontend/web RUN if [ ! -d "frontend/web/assets" ]; then mkdir frontend/web/assets; fi && \ chown www-data:www-data frontend/web/assets RUN chown www-data:www-data assets \ && chmod 777 -R frontend/runtime && chown -R www-data:www-data /var/log/apache2 RUN if [ ! -d "frontend/runtime/sess" ]; then mkdir frontend/runtime/sess; fi && \ chown -R www-data:www-data frontend/runtime/sess RUN chown -R www-data:www-data frontend/messages RUN rm -rf /var/www/html/frontend/web/css && ln -s /var/www/html/css /var/www/html/frontend/web/css RUN rm -rf /var/www/html/frontend/web/bootstrap && ln -s /var/www/html/bootstrap /var/www/html/frontend/web/bootstrap RUN rm -rf /var/www/html/frontend/web/js && ln -s /var/www/html/js /var/www/html/frontend/web/js RUN rm -rf /var/www/html/frontend/web/images && ln -s /var/www/html/images /var/www/html/frontend/web/images RUN rm -rf /var/www/html/frontend/web/fonts && ln -s /var/www/html/fonts /var/www/html/frontend/web/fonts RUN rm -rf /var/www/html/frontend/web/img && mkdir /var/www/html/frontend/web/img RUN echo "MY_GOOGLE_STORAGE_BUCKET /var/www/html/frontend/web/img gcsfuse rw,allow_other,implicit_dirs,dir_mode=777,file_mode=777" >> /etc/fstab EXPOSE 8080 ADD app_engine/YOUR_GOOGLE_APP-CREDENTIALS.json /etc/gcloud/service-account.json ENV GOOGLE_APPLICATION_CREDENTIALS /etc/gcloud/service-account.json