From 40a9932434d2494d3084294fd347e4c28e94cf17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Phil=20H=C3=B6fer?= <phil@suma-ev.de>
Date: Fri, 21 Sep 2018 12:03:19 +0200
Subject: [PATCH] Fix database error when using Docker

---
 .env.example                    |  7 -------
 Dockerfile                      |  3 ++-
 resources/views/index.blade.php | 12 +++++++-----
 3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/.env.example b/.env.example
index ea1c1f852..6e97c9fcf 100644
--- a/.env.example
+++ b/.env.example
@@ -4,13 +4,6 @@ APP_LOG_LEVEL=debug
 APP_KEY=
 APP_URL=http://localhost
 
-DB_CONNECTION=mysql
-DB_HOST=127.0.0.1
-DB_PORT=3306
-DB_DATABASE=homestead
-DB_USERNAME=homestead
-DB_PASSWORD=secret
-
 BROADCAST_DRIVER=log
 CACHE_DRIVER=file
 SESSION_DRIVER=file
diff --git a/Dockerfile b/Dockerfile
index 2e036d357..f97deac79 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,13 +14,14 @@ RUN apt-get update && apt-get install -y \
     sqlite3 \
     nodejs \
     libpng-dev \
+    unzip \
     npm
 RUN npm install gulp -g
 
 COPY . /app
 WORKDIR app
 RUN mv config/sumas.xml.example config/sumas.xml && mv .env.example .env
-RUN composer install
+RUN composer install --no-plugins --no-scripts
 RUN npm install
 RUN npm run dev
 
diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php
index b05c226df..7afe1cfb4 100644
--- a/resources/views/index.blade.php
+++ b/resources/views/index.blade.php
@@ -25,11 +25,13 @@
 		<div id="sponsors">
 			<h2>{{ trans('index.sponsors.head.2') }}</h2>
 			<ul class="startpage">
-				@foreach(DB::table('sponsorenlinks')->where('langcode', 'de')->orderByRaw('LENGTH(linktext)', 'ASC')->get() as $link)
-				<li class="sponsor">
-					<a href="{{ $link->link }}" target="_blank" rel="noopener"><p>{{ $link->linktext }}</p> <i class="fa fa-external-link"></i></a>
-				</li>
-				@endforeach
+                @if (getenv('DB_CONNECTION')==='mysql')
+                    @foreach(DB::table('sponsorenlinks')->where('langcode', 'de')->orderByRaw('LENGTH(linktext)', 'ASC')->get() as $link)
+                    <li class="sponsor">
+                        <a href="{{ $link->link }}" target="_blank" rel="noopener"><p>{{ $link->linktext }}</p> <i class="fa fa-external-link"></i></a>
+                    </li>
+                    @endforeach
+				@endif
 			</ul>
 		</div>
 	</div>
-- 
GitLab