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