Skip to content

Instantly share code, notes, and snippets.

@ziadoz
Last active June 30, 2022 06:53
Show Gist options
  • Save ziadoz/ee2e73450c344f1953e53c018a2a63a7 to your computer and use it in GitHub Desktop.
Save ziadoz/ee2e73450c344f1953e53c018a2a63a7 to your computer and use it in GitHub Desktop.
Install glibc on PHP Alpine Docker Image
FROM php:8-cli-alpine
# @see: @see: https://stackoverflow.com/a/65969295
RUN apk --no-cache add binutils curl \
&& GLIBC_VER=$(curl -s https://api.github.com/repos/sgerrand/alpine-pkg-glibc/releases/latest | grep tag_name | cut -d : -f 2 | tr -d \",' ') \
&& curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
&& curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk \
&& curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk \
&& apk add --no-cache \
glibc-${GLIBC_VER}.apk \
glibc-bin-${GLIBC_VER}.apk \
&& apk --no-cache del binutils curl \
&& rm glibc-${GLIBC_VER}.apk \
&& rm glibc-bin-${GLIBC_VER}.apk \
&& rm -rf /var/cache/apk/*
@vincentchalamon
Copy link

cut -d : -f 2,3 | tr -d \",' ' returns the following string: 2.35-r0:
I suggess cut -d : -f 2 | tr -d \",' ' which returns a valid glibc version: 2.35-r0

@ziadoz
Copy link
Author

ziadoz commented Jun 29, 2022

@vincentchalamon Good spot. I've changed it. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment