diff --git a/Dockerfile b/Dockerfile
index d0b9e8d819d1485723dcf35f9b8de52893b1aeb6..6339e841744c47f9d8d544a7c67736c1ac3d26cf 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -50,7 +50,13 @@ RUN echo 'hosts: files dns' > /etc/nsswitch.conf && \
     echo "StrictHostKeyChecking no" >> /root/.ssh/config && \
     \
     apk update && \
-    apk add --no-cache mdocml-apropos openssh wget make patch bash fish python3 git git-lfs unzip acl libpng-dev libzip-dev gnu-libiconv && \
+    apk add --no-cache mdocml-apropos openssh wget make patch bash fish python3 git git-lfs unzip acl libpng-dev libzip-dev && \
+    if [ "${PHP_VERSION}" = "7.3" ]; then \
+      apk add --no-cache gnu-libiconv ; \
+    fi && \
+    if [ "${PHP_VERSION}" = "7.4" ]; then \
+      apk add --no-cache gnu-libiconv ; \
+    fi && \
     \
     wget -q https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -O /etc/apk/keys/sgerrand.rsa.pub && \
     wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${glibc_version}/glibc-${glibc_version}.apk && \