Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
bluecraank committed Aug 21, 2024
1 parent 37f2467 commit bc8f825
Show file tree
Hide file tree
Showing 4 changed files with 293 additions and 291 deletions.
65 changes: 31 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
#Installiere Alpine, PHP und Nginx
FROM serversideup/php:8.3-fpm-nginx-alpine
USER root

# Workdirectory setzen
WORKDIR /var/www/html

# Packages installieren
RUN apk add --update libjpeg-turbo-dev libpng-dev libzip-dev ghostscript openldap npm

# Ldap certificate prüfen auf never stellen
RUN echo "TLS_REQCERT never" >> /etc/openldap/ldap.conf && install-php-extensions ldap imagick gd

# Projekt kopieren
COPY . /var/www/html

# .env.example kopieren
COPY .env.example.productive /var/www/html/.env

# Laravel.log file erstellen
RUN touch /var/www/html/storage/logs/laravel.log && chown -R www-data:www-data /var/www/html/storage/logs/laravel.log && chown -R www-data:www-data /var/www/html && composer install --no-dev --optimize-autoloader

RUN npm i && npm run build

# Laravel App Key generieren
RUN php artisan key:generate

# Imagick Limits erhöhen
RUN sed -ri -e 's/<policy domain="resource" name="memory" value="256MiB"\/>/<policy domain="resource" name="memory" value="2GiB"\/>/g' /etc/ImageMagick-6/policy.xml
RUN sed -ri -e 's/<policy domain="resource" name="map" value="512MiB"\/>/<policy domain="resource" name="map" value="8GiB"\/>/g' /etc/ImageMagick-6/policy.xml
RUN sed -ri -e 's/<policy domain="resource" name="disk" value="1GiB"\/>/<policy domain="resource" name="disk" value="8GiB"\/>/g' /etc/ImageMagick-6/policy.xml

# User auf www-data setzen
USER www-data
#Installiere Alpine, PHP und Nginx
FROM serversideup/php:8.3-fpm-nginx-alpine
USER root

# Workdirectory setzen
WORKDIR /var/www/html

# Projekt kopieren
COPY . /var/www/html

# .env.example kopieren
COPY .env.example.productive /var/www/html/.env

# Packages installieren
RUN apk add --no-cache --virtual build-depend --update libjpeg-turbo-dev libpng-dev libzip-dev ghostscript openldap npm imagemagick && \
echo "TLS_REQCERT never" >> /etc/openldap/ldap.conf && \
install-php-extensions ldap imagick gd && \
touch /var/www/html/storage/logs/laravel.log && \
chown -R www-data:www-data /var/www/html/storage/logs/laravel.log && \
chown -R www-data:www-data /var/www/html && \
composer install --no-dev --optimize-autoloader && \
npm i && \
npm run build && \
php artisan key:generate && \
sed -ri -e 's/<policy domain="resource" name="memory" value="256MiB"\/>/<policy domain="resource" name="memory" value="2GiB"\/>/g' /etc/ImageMagick-7/policy.xml && \
sed -ri -e 's/<policy domain="resource" name="map" value="512MiB"\/>/<policy domain="resource" name="map" value="8GiB"\/>/g' /etc/ImageMagick-7/policy.xml && \
sed -ri -e 's/<policy domain="resource" name="disk" value="1GiB"\/>/<policy domain="resource" name="disk" value="8GiB"\/>/g' /etc/ImageMagick-7/policy.xml && \
apk del build-depend

# User auf www-data setzen
USER www-data
5 changes: 5 additions & 0 deletions app/Http/Controllers/DeviceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ public function destroy(string $id)
public function discover(Request $request) {
$ip = request()->ip();

// If HTTP_X_FORWARDED_FOR is set, use that instead
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}

$device = Device::where('ip_address', $ip)->first();

if($device) {
Expand Down
Loading

0 comments on commit bc8f825

Please sign in to comment.