Skip to content

Instantly share code, notes, and snippets.

@cristobal
Created March 30, 2016 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cristobal/726af571b0c4112ef907f769332184b1 to your computer and use it in GitHub Desktop.
Save cristobal/726af571b0c4112ef907f769332184b1 to your computer and use it in GitHub Desktop.
Alpine with GLIBC and Oracle InstantClient
FROM alpine:3.3
# Update and upgrade
RUN apk update && \
apk upgrade
# Set correct timezone
RUN setup-timezone -z Europe/Oslo
# Install build essentials + dev tools
RUN apk add --virtual=build-dependencies \
build-base \
binutils-gold \
ca-certificates \
curl \
git \
gnupg \
linux-headers \
paxctl \
tar \
xz
# Install GNU libc (aka glibc) and set C.UTF-8 locale as default.
# @see https://hub.docker.com/r/frolvlad/alpine-glibc/~/dockerfile/
RUN ALPINE_GLIBC_BASE_URL="https://github.com/andyshinn/alpine-pkg-glibc/releases/download" && \
ALPINE_GLIBC_PACKAGE_VERSION="2.23-r1" && \
ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
mkdir /tmp/glibc && \
cd /tmp/glibc && \
curl -SLO "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" && \
curl -SLO "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" && \
curl -SLO "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
apk add --no-cache --allow-untrusted \
"$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
/usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 C.UTF-8 || true && \
/usr/glibc-compat/sbin/ldconfig "/lib" "/usr/glibc/usr/lib" && \
echo "export LANG=C.UTF-8" > /etc/profile.d/locale.sh
# Set default LANG
ENV LANG=C.UTF-8
...
# Make Oracle instantclient available and set ENV variables
# @see https://github.com/oracle/node-oracledb/blob/master/INSTALL.md#instzip
ADD opt/oracle/instantclient/linux/ /opt/oracle/instantclient
ENV OCI_LIB_DIR=/opt/oracle/instantclient \
OCI_INC_DIR=/opt/oracle/instantclient/sdk/include \
LD_LIBRARY_PATH=/opt/oracle/instantclient:/usr/glibc-compat/lib
# Install libaio needed when compiling the node oracledb module
RUN apk add libaio
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment