forked from oocengg/katteri_proyek2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_1
48 lines (38 loc) · 1.33 KB
/
Dockerfile_1
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
# docker file for existing laravel project with apache, php 8.1.0, mysql, composer and php imagick
#
# Build: docker build -t laravel:latest .
# Run: docker run -d -p 8080:80 --name laravel laravel:latest
# Access: http://localhost:8080
FROM php:8.1.0-apache
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libpq-dev \
libzip-dev \
unzip \
libmagickwand-dev \
&& docker-php-ext-configure gd --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd \
&& pecl install imagick \
&& docker-php-ext-enable imagick
COPY .env .
RUN sed -i 's/DB_HOST=127.0.0.1/DB_HOST=db/g' .env
RUN sed -i 's/DB_DATABASE=homestead/DB_DATABASE=laravel/g' .env
RUN sed -i 's/DB_USERNAME=homestead/DB_USERNAME=root/g' .env
RUN sed -i 's/DB_PASSWORD=secret/DB_PASSWORD=password/g' .env
RUN docker-php-ext-install pdo pdo_mysql
COPY . .
# install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer install
RUN php artisan key:generate
RUN php artisan config:cache
RUN chown -R www-data:www-data .
# Allow permission to apache
RUN a2enmod rewrite
RUN chown -R www-data:www-data /var/www/html
# configure apache
COPY apache2.conf /etc/apache2/apache2.conf
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
EXPOSE 80
CMD ["apache2-foreground"]