-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·64 lines (45 loc) · 1.61 KB
/
Dockerfile
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Use an official PHP image with Apache as the base image.
FROM php:7.4-apache
# Set environment variables.
ENV ACCEPT_EULA=Y
LABEL maintainer="[email protected]"
# Install system dependencies.
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
zip \
unzip \
git \
&& rm -rf /var/lib/apt/lists/*
# Create a directory for your Laravel application.
WORKDIR /var/www/html/
# Copy the Laravel application files into the container.
COPY . .
# Enable Apache modules required for Laravel.
RUN a2enmod rewrite
# Set the Apache document root
ENV APACHE_DOCUMENT_ROOT /var/www/html/
# Update the default Apache site configuration
COPY apache-config.conf /etc/apache2/sites-available/000-default.conf
# Install PHP extensions.
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd pdo pdo_mysql exif
# Install Composer globally.
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Set permissions for Laravel.
RUN chown -R www-data:www-data storage bootstrap/cache
RUN mkdir vendor mysql_data
# Install Laravel dependencies using Composer.
RUN composer install --no-interaction --optimize-autoloader
RUN chmod 777 vendor
#RUN composer update
# Expose port 80 for Apache.
EXPOSE 80
# Start Apache web server.
CMD ["apache2-foreground"]
# Restart Apache to apply the changes
#CMD ["apache2ctl", "restart", "apache2"]
# Start Apache web server.
# CMD ["apache2-foreground"]
# You can add any additional configurations or commands required for Laravel 10 here.