Skip to content

Instantly share code, notes, and snippets.

@vermotr
Created December 3, 2024 20:57
Show Gist options
  • Save vermotr/f124a97cc4d84953c5c52866a64489f9 to your computer and use it in GitHub Desktop.
Save vermotr/f124a97cc4d84953c5c52866a64489f9 to your computer and use it in GitHub Desktop.
Dockerfile to build an older Directus version with a specific VIPS version, supporting old hardware and avoiding Illegal instruction (core dumped)
FROM node:18
WORKDIR /directus
# Set environment variables for Directus
ENV NODE_ENV=production
ENV PORT=8055
RUN apt-get update && apt-get install -y \
build-essential \
wget \
git \
pkg-config
RUN apt-get install -y python3 python3-pip python3-setuptools \
python3-wheel python3.11-venv
# Create a virtual environment
RUN python3 -m venv .venv
# Activate the virtual environment
ENV PATH="/directus/.venv/bin:$PATH"
RUN pip3 install meson ninja
RUN apt-get install -y \
libexpat1-dev \
librsvg2-dev \
libpng-dev \
libjpeg-dev \
libwebp-dev \
libexif-dev \
liblcms2-dev \
libglib2.0-dev \
liborc-dev \
libgirepository1.0-dev \
libheif1 \
libheif-dev \
gettext
ARG VIPS_VER=8.15.2
ARG VIPS_DLURL=https://github.com/libvips/libvips/releases/download
RUN <<EOF
cd /usr/local/src
wget ${VIPS_DLURL}/v${VIPS_VER}/vips-${VIPS_VER}.tar.xz
tar xf vips-${VIPS_VER}.tar.xz
cd vips-${VIPS_VER}
meson setup build --buildtype=release
cd build
meson compile
meson test
meson install
EOF
RUN ldconfig
RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/vips/lib
# Install Directus
RUN npm install [email protected]
# Expose the Directus port
EXPOSE 8055
RUN mkdir -p database extensions uploads
ENV \
DB_CLIENT="sqlite3" \
DB_FILENAME="/directus/database/database.sqlite" \
NODE_ENV="production" \
NPM_CONFIG_UPDATE_NOTIFIER="false"
# Start Directus
CMD ["npx", "directus", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment