Docker-DockerComposeOrchest.../Dockerfile.prod

48 lines
1.1 KiB
Docker

FROM php:8.2-cli
WORKDIR /var/www
# Install build dependencies & PHP extensions
RUN apk add --no-cache \
bash \
git \
unzip \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
libzip-dev \
icu-dev \
zlib-dev \
postgresql-dev \
curl \
oniguruma-dev \
autoconf \
gcc \
g++ \
make \
pkgconfig \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install pdo pdo_pgsql mbstring zip intl bcmath gd \
&& rm -rf /var/cache/apk/*
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
# Copy project
COPY . /var/www
# Set permissions
RUN mkdir -p storage bootstrap/cache \
&& chown -R www-data:www-data storage bootstrap/cache
# Install Laravel dependencies & optimasi
RUN composer install --no-dev --optimize-autoloader
# Cache Laravel
RUN php artisan config:cache \
&& php artisan route:cache \
&& php artisan view:cache
EXPOSE 8000
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]