-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (38 loc) · 1.12 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (38 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
44
45
46
47
48
49
FROM php:8.2-apache
# Install dependencies
RUN apt-get update && apt-get install -y \
libpq-dev \
libzip-dev \
zip \
unzip \
nodejs \
npm \
&& docker-php-ext-install pdo pdo_pgsql zip
# Enable Apache mod_rewrite
RUN a2enmod rewrite
# Set working directory
WORKDIR /var/www/html
# Copy composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy project files
COPY . .
# Install PHP dependencies
RUN composer install --no-dev --optimize-autoloader
# Install Node dependencies and build assets
RUN npm install && npm run build
# Set permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html/storage \
&& chmod -R 755 /var/www/html/bootstrap/cache
# Apache configuration
RUN echo '<VirtualHost *:80>\n\
DocumentRoot /var/www/html/public\n\
<Directory /var/www/html/public>\n\
AllowOverride All\n\
Require all granted\n\
</Directory>\n\
</VirtualHost>' > /etc/apache2/sites-available/000-default.conf
# Expose port
EXPOSE 80
# Start Apache
CMD php artisan migrate --force && php artisan config:cache && apache2-foreground