Skip to content

Commit

Permalink
Simplify Backend
Browse files Browse the repository at this point in the history
  • Loading branch information
flemming-pr committed Dec 3, 2024
1 parent 9ecff25 commit be5182c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 121 deletions.
37 changes: 10 additions & 27 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,25 @@ WORKDIR /var/www/html
# Install Composer manually
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer

RUN apk add --no-cache \
npm

COPY ./ /var/www/html

RUN composer install --optimize-autoloader --no-interaction --no-dev --ignore-platform-req=ext-intl
RUN ls -al

FROM unit:php8.2
RUN composer install --optimize-autoloader --no-interaction --no-dev --ignore-platform-req=ext-intl

RUN mkdir -p /var/www/html
RUN mkdir -p /var/www/html/databasestore

WORKDIR /var/www/html

COPY --from=build --chown=unit:unit /var/www/html /var/www/html

ENV TZ=Europe/Berlin

# Update package lists and install required dependencies
RUN apt-get update && apt-get install -y \
netcat-traditional \
libicu-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
sudo \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN apk add --no-cache \
icu-dev \
icu-libs \
zlib-dev
# Install and enable the intl and gd extensions
RUN docker-php-ext-install intl gd pdo_mysql

COPY docker/config.json /docker-entrypoint.d/config.json

COPY docker/entrypoint.sh /docker-entrypoint.d/entrypoint.sh
RUN docker-php-ext-install intl pdo_mysql

RUN chmod +x /docker-entrypoint.d/entrypoint.sh
RUN chmod +x /var/www/html/entrypoint.sh

EXPOSE 80
ENTRYPOINT ["sh", "/var/www/html/entrypoint.sh" ]
CMD ["php", "-S", "0.0.0.0:80", "-t", "/var/www/html/public"]
41 changes: 0 additions & 41 deletions backend/docker/Caddyfile

This file was deleted.

30 changes: 0 additions & 30 deletions backend/docker/config.json

This file was deleted.

23 changes: 0 additions & 23 deletions backend/docker/entrypoint.sh

This file was deleted.

15 changes: 15 additions & 0 deletions backend/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

cd /var/www/html && mkdir -p storage/framework/{sessions,views,cache}
cd /var/www/html && php artisan storage:link
cd /var/www/html && php artisan optimize:clear
cd /var/www/html && php artisan config:cache
cd /var/www/html && php artisan route:cache
cd /var/www/html && php artisan view:cache
cd /var/www/html && php artisan event:cache

# Wait until db is online
sleep 1
cd /var/www/html && php artisan migrate --force

exec "$@"

0 comments on commit be5182c

Please sign in to comment.