souliya_pps commited on
Commit
ea83610
·
1 Parent(s): dfd19e2

Revert "Move DB decompression to entrypoint (runtime) to fix Docker build OOM on HF"

Browse files

This reverts commit 4cc5ece6d04da68cf788191cd0ce7a21519fbbbf.

Files changed (2) hide show
  1. Dockerfile +4 -0
  2. entrypoint.sh +0 -11
Dockerfile CHANGED
@@ -31,6 +31,10 @@ RUN composer install --no-dev --optimize-autoloader --no-interaction
31
  COPY . .
32
 
33
  RUN mkdir -p storage/cache/sqlite storage/tmp storage/tts && chmod -R 777 storage
 
 
 
 
34
 
35
  COPY entrypoint.sh /entrypoint.sh
36
  RUN chmod +x /entrypoint.sh
 
31
  COPY . .
32
 
33
  RUN mkdir -p storage/cache/sqlite storage/tmp storage/tts && chmod -R 777 storage
34
+ RUN for f in databases/*.sqlite.gz; do \
35
+ code=$(basename "$f" .sqlite.gz); \
36
+ php -d memory_limit=256M -r "file_put_contents('storage/cache/sqlite/${code}.sqlite', gzdecode(file_get_contents('databases/${code}.sqlite.gz')));"; \
37
+ done
38
 
39
  COPY entrypoint.sh /entrypoint.sh
40
  RUN chmod +x /entrypoint.sh
entrypoint.sh CHANGED
@@ -4,15 +4,4 @@ set -e
4
  # Overwrite .env from environment variables so the app's custom loader picks them up
5
  env > /var/www/html/.env
6
 
7
- # Decompress SQLite databases on first boot
8
- if [ -n "$(ls /var/www/html/databases/*.sqlite.gz 2>/dev/null)" ]; then
9
- for f in /var/www/html/databases/*.sqlite.gz; do
10
- code=$(basename "$f" .sqlite.gz)
11
- target="/var/www/html/storage/cache/sqlite/${code}.sqlite"
12
- if [ ! -f "$target" ]; then
13
- php -d memory_limit=512M -r "file_put_contents('$target', gzdecode(file_get_contents('$f')));"
14
- fi
15
- done
16
- fi
17
-
18
  exec apache2-foreground
 
4
  # Overwrite .env from environment variables so the app's custom loader picks them up
5
  env > /var/www/html/.env
6
 
 
 
 
 
 
 
 
 
 
 
 
7
  exec apache2-foreground