Skip to content

Instantly share code, notes, and snippets.

@dcoppari
Created July 24, 2020 02:56
Show Gist options
  • Save dcoppari/611ac599ba75997ecd32fcaf8b0c1719 to your computer and use it in GitHub Desktop.
Save dcoppari/611ac599ba75997ecd32fcaf8b0c1719 to your computer and use it in GitHub Desktop.
Dockerfile to with imagick
FROM php:7.4-alpine
ARG GLIB_VERSION="2.31-r0"
# Install language pack
RUN apk --no-cache add ca-certificates wget && \
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIB_VERSION}/glibc-${GLIB_VERSION}.apk && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIB_VERSION}/glibc-bin-${GLIB_VERSION}.apk && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIB_VERSION}/glibc-i18n-${GLIB_VERSION}.apk && \
apk add glibc-bin-${GLIB_VERSION}.apk glibc-i18n-${GLIB_VERSION}.apk glibc-${GLIB_VERSION}.apk
# Iterate through all locale and install it
# Note that locale -a is not available in alpine linux, use `/usr/glibc-compat/bin/locale -a` instead
RUN echo "es_AR" | xargs -i /usr/glibc-compat/bin/localedef -i {} -f UTF-8 {}.UTF-8
# Set the lang, you can also specify it as as environment variable through docker-compose.yml
ENV LANG=es_AR.UTF-8 \
LANGUAGE=es_AR.UTF-8
ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && install-php-extensions imagick
EXPOSE 8080
WORKDIR /run
COPY . /run
RUN chmod +x /run/entrypoint.sh
# Entrypoint be like: cd /run && exec "$@"
ENTRYPOINT ["/run/entrypoint.sh"]
CMD ["php", "-S", "0.0.0.0:8080"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment