-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (35 loc) · 1.14 KB
/
Dockerfile
File metadata and controls
45 lines (35 loc) · 1.14 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
# Sử dụng hình ảnh PHP chính thức
FROM php:8.2-fpm
# Thiết lập thư mục làm việc
WORKDIR /var/www/html
# Cài đặt các phụ thuộc hệ thống
RUN apt-get update && apt-get install -y \
git \
curl \
zip \
unzip \
netcat-openbsd \
libpng-dev \
libonig-dev \
libxml2-dev \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
# Cài đặt Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Sao chép mã nguồn ứng dụng
COPY . .
# Cài đặt các phụ thuộc PHP
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
# Thiết lập quyền cho các thư mục cần thiết
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html \
&& chmod -R 775 /var/www/html/storage \
&& chmod -R 775 /var/www/html/bootstrap/cache
# Sao chép script chờ MySQL vào container
COPY wait-for-mysql.sh /usr/local/bin/wait-for-mysql.sh
RUN chmod +x /usr/local/bin/wait-for-mysql.sh
# Thiết lập entrypoint
ENTRYPOINT ["wait-for-mysql.sh"]
# Expose cổng 9000
EXPOSE 9000
# Khởi chạy PHP-FPM
CMD ["php-fpm"]