-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (30 loc) · 1.12 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (30 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Use official PHP image with Apache
FROM php:8.2-apache
# Install system dependencies and PHP extensions
RUN apt-get update && apt-get install -y \
git unzip zip curl libzip-dev libonig-dev libxml2-dev libpq-dev npm \
&& docker-php-ext-install pdo_pgsql mbstring zip xml
# Enable Apache mod_rewrite
RUN a2enmod rewrite
# Replace default site config with your Laravel-friendly one
COPY apache/000-default.conf /etc/apache2/sites-available/000-default.conf
# Set working directory
WORKDIR /var/www/html
# Copy project files
COPY . /var/www/html
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Install PHP dependencies
RUN composer require fakerphp/faker
RUN composer install --no-dev --optimize-autoloader
# Copy env and generate app key
RUN cp .env.example .env && php artisan key:generate
# Install Node.js deps and build Vite assets
RUN npm install
RUN npm run build
# Set permissions for storage and cache
RUN chown -R www-data:www-data storage bootstrap/cache
# Expose port 80 (Apache default)
EXPOSE 80
# Start Apache
CMD php artisan migrate:fresh --force --seed && apache2-foreground