add two more
This commit is contained in:
parent
b8508627bf
commit
9a636f24ed
|
|
@ -5,14 +5,15 @@ FROM composer:2 AS vendor
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
COPY composer.json composer.lock ./
|
||||
COPY . .
|
||||
|
||||
# install dependencies cleanly (NO MIRROR, NO DEV)
|
||||
RUN composer install \
|
||||
--no-dev \
|
||||
--prefer-dist \
|
||||
--no-interaction \
|
||||
--optimize-autoloader
|
||||
--optimize-autoloader \
|
||||
--no-scripts
|
||||
|
||||
# =========================
|
||||
# Stage 2: Runtime
|
||||
|
|
@ -23,27 +24,22 @@ WORKDIR /var/www/html
|
|||
|
||||
# system deps
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
unzip \
|
||||
libzip-dev \
|
||||
curl \
|
||||
git unzip libzip-dev curl \
|
||||
&& docker-php-ext-install pdo pdo_mysql zip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# copy vendor from stage 1
|
||||
COPY --from=vendor /app/vendor ./vendor
|
||||
COPY --from=vendor /app /var/www/html
|
||||
|
||||
# copy project files
|
||||
COPY . .
|
||||
|
||||
# permissions
|
||||
RUN chown -R www-data:www-data /var/www/html
|
||||
|
||||
# entrypoint
|
||||
COPY ./docker/php/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["php-fpm"]
|
||||
|
||||
EXPOSE 9000
|
||||
CMD ["php-fpm"]
|
||||
|
|
|
|||
|
|
@ -1,30 +1,21 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "[+] Laravel container starting..."
|
||||
echo "[+] Starting Laravel..."
|
||||
|
||||
# .env
|
||||
if [ ! -f .env ]; then
|
||||
echo "[+] Creating .env"
|
||||
cp .env.example .env
|
||||
fi
|
||||
|
||||
# safety check
|
||||
if [ ! -f vendor/autoload.php ]; then
|
||||
echo "[❌] vendor missing! build image again"
|
||||
echo "[ERROR] vendor missing - rebuild image"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# key generate only if not set
|
||||
if ! grep -q "APP_KEY=base64" .env; then
|
||||
echo "[+] Generating APP KEY"
|
||||
php artisan key:generate --no-interaction
|
||||
php artisan key:generate --force
|
||||
fi
|
||||
|
||||
# cache optimize (optional but good)
|
||||
php artisan config:cache || true
|
||||
php artisan route:cache || true
|
||||
|
||||
echo "[+] Starting PHP-FPM..."
|
||||
|
||||
echo "[+] Starting PHP-FPM"
|
||||
exec php-fpm
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user