Files
jinniu-daikuan/Dockerfile
T
梁铭洋andCursor 472cf7942e Fix Docker build: enable PHP gd for PhpSpreadsheet.
Composer install failed because phpspreadsheet requires ext-gd; install libpng/jpeg/freetype and compile gd.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-29 16:04:04 +08:00

42 lines
1.1 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FROM php:8.2-apache
ENV DEBIAN_FRONTEND=noninteractive
# pdo_sqlite / zip / gdPhpSpreadsheet 需要 gd
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libsqlite3-dev \
libzip-dev \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install pdo_sqlite zip gd \
&& a2enmod rewrite headers \
&& rm -rf /var/lib/apt/lists/*
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
COPY docker/apache-vhost.conf /etc/apache2/sites-available/000-default.conf
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
COPY composer.json ./
RUN composer install --no-dev --prefer-dist --no-interaction --optimize-autoloader
COPY app ./app
COPY public ./public
COPY data ./data
COPY uploads ./uploads
RUN chown -R www-data:www-data /var/www/html/data /var/www/html/uploads \
&& chmod -R 775 /var/www/html/data /var/www/html/uploads
EXPOSE 80
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["apache2-foreground"]