-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (36 loc) · 1.25 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
FROM php:8.1-fpm
# Install dependencies
RUN apt-get update && apt-get install -y \
git \
unzip \
libzip-dev \
libxml2-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libgd-dev \
nginx \
supervisor
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) zip xml gd
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /app
# Clone the repository
RUN git clone https://github.com/fruitcake514/phpoffice-docker.git .
# Install PHPOffice libraries
RUN composer install --no-dev --optimize-autoloader
# Copy configuration files
COPY nginx.conf /etc/nginx/sites-available/default
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Create data directory and set permissions
RUN mkdir -p /app/public/data \
&& chown -R www-data:www-data /app \
&& chmod -R 755 /app \
&& chmod -R 777 /app/public/data
# Configure PHP-FPM to run as www-data
RUN sed -i 's/user = www-data/user = www-data/g' /usr/local/etc/php-fpm.d/www.conf \
&& sed -i 's/group = www-data/group = www-data/g' /usr/local/etc/php-fpm.d/www.conf
EXPOSE 80
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]