Skip to content

Commit a99df75

Browse files
committed
Add "ghostscript" for generating PDF thumbnails
When uploading PDFs to the Media Library, WordPress (since 4.7) will generate a thumbnail via ImageMagick. We have ImageMagick, but without Ghostscript installed it is unable to process PDF files (since it uses Ghostscript to render PDFs into images that it can then handle directly).
1 parent cc5e638 commit a99df75

File tree

11 files changed

+79
-8
lines changed

11 files changed

+79
-8
lines changed

Dockerfile-alpine.template

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
FROM php:%%PHP_VERSION%%-%%VARIANT%%
22

3-
# docker-entrypoint.sh dependencies
3+
# persistent dependencies
44
RUN apk add --no-cache \
55
# in theory, docker-entrypoint.sh is POSIX-compliant, but priority is a working, consistent image
66
bash \
77
# BusyBox sed is not sufficient for some of our sed expressions
8-
sed
8+
sed \
9+
# Ghostscript is required for rendering PDF previews
10+
ghostscript
911

1012
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
1113
RUN set -ex; \

Dockerfile-debian.template

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
FROM php:%%PHP_VERSION%%-%%VARIANT%%
22

3+
# persistent dependencies
4+
RUN set -eux; \
5+
apt-get update; \
6+
apt-get install -y --no-install-recommends \
7+
# Ghostscript is required for rendering PDF previews
8+
ghostscript \
9+
; \
10+
rm -rf /var/lib/apt/lists/*
11+
312
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
413
RUN set -ex; \
514
\

php7.1/apache/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
FROM php:7.1-apache
22

3+
# persistent dependencies
4+
RUN set -eux; \
5+
apt-get update; \
6+
apt-get install -y --no-install-recommends \
7+
# Ghostscript is required for rendering PDF previews
8+
ghostscript \
9+
; \
10+
rm -rf /var/lib/apt/lists/*
11+
312
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
413
RUN set -ex; \
514
\

php7.1/fpm-alpine/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
FROM php:7.1-fpm-alpine
22

3-
# docker-entrypoint.sh dependencies
3+
# persistent dependencies
44
RUN apk add --no-cache \
55
# in theory, docker-entrypoint.sh is POSIX-compliant, but priority is a working, consistent image
66
bash \
77
# BusyBox sed is not sufficient for some of our sed expressions
8-
sed
8+
sed \
9+
# Ghostscript is required for rendering PDF previews
10+
ghostscript
911

1012
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
1113
RUN set -ex; \

php7.1/fpm/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
FROM php:7.1-fpm
22

3+
# persistent dependencies
4+
RUN set -eux; \
5+
apt-get update; \
6+
apt-get install -y --no-install-recommends \
7+
# Ghostscript is required for rendering PDF previews
8+
ghostscript \
9+
; \
10+
rm -rf /var/lib/apt/lists/*
11+
312
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
413
RUN set -ex; \
514
\

php7.2/apache/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
FROM php:7.2-apache
22

3+
# persistent dependencies
4+
RUN set -eux; \
5+
apt-get update; \
6+
apt-get install -y --no-install-recommends \
7+
# Ghostscript is required for rendering PDF previews
8+
ghostscript \
9+
; \
10+
rm -rf /var/lib/apt/lists/*
11+
312
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
413
RUN set -ex; \
514
\

php7.2/fpm-alpine/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
FROM php:7.2-fpm-alpine
22

3-
# docker-entrypoint.sh dependencies
3+
# persistent dependencies
44
RUN apk add --no-cache \
55
# in theory, docker-entrypoint.sh is POSIX-compliant, but priority is a working, consistent image
66
bash \
77
# BusyBox sed is not sufficient for some of our sed expressions
8-
sed
8+
sed \
9+
# Ghostscript is required for rendering PDF previews
10+
ghostscript
911

1012
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
1113
RUN set -ex; \

php7.2/fpm/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
FROM php:7.2-fpm
22

3+
# persistent dependencies
4+
RUN set -eux; \
5+
apt-get update; \
6+
apt-get install -y --no-install-recommends \
7+
# Ghostscript is required for rendering PDF previews
8+
ghostscript \
9+
; \
10+
rm -rf /var/lib/apt/lists/*
11+
312
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
413
RUN set -ex; \
514
\

php7.3/apache/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
FROM php:7.3-apache
22

3+
# persistent dependencies
4+
RUN set -eux; \
5+
apt-get update; \
6+
apt-get install -y --no-install-recommends \
7+
# Ghostscript is required for rendering PDF previews
8+
ghostscript \
9+
; \
10+
rm -rf /var/lib/apt/lists/*
11+
312
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
413
RUN set -ex; \
514
\

php7.3/fpm-alpine/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
FROM php:7.3-fpm-alpine
22

3-
# docker-entrypoint.sh dependencies
3+
# persistent dependencies
44
RUN apk add --no-cache \
55
# in theory, docker-entrypoint.sh is POSIX-compliant, but priority is a working, consistent image
66
bash \
77
# BusyBox sed is not sufficient for some of our sed expressions
8-
sed
8+
sed \
9+
# Ghostscript is required for rendering PDF previews
10+
ghostscript
911

1012
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
1113
RUN set -ex; \

php7.3/fpm/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
FROM php:7.3-fpm
22

3+
# persistent dependencies
4+
RUN set -eux; \
5+
apt-get update; \
6+
apt-get install -y --no-install-recommends \
7+
# Ghostscript is required for rendering PDF previews
8+
ghostscript \
9+
; \
10+
rm -rf /var/lib/apt/lists/*
11+
312
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
413
RUN set -ex; \
514
\

0 commit comments

Comments
 (0)