strapi-community / strapi-tool-dockerize

Easy add support for docker to your strapi project
MIT License
504 stars 34 forks source link

VipsOperation: class "heifsave_buffer" not found #102

Closed ainsleyclark closed 8 months ago

ainsleyclark commented 8 months ago

🐛 Bug Report

🤷‍♀️ What did you do

Running the dockerfile on DigitalOcean runners produces a Sharp related error when transpiling to image formats.

Dockerfile

# Build
FROM node:18-alpine as build

ARG DATABASE_URL

ENV NODE_ENV=production
ENV DATABASE_URL=${DATABASE_URL}

WORKDIR /opt/
COPY package*.json ./
RUN apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev > /dev/null 2>&1
RUN npm install --omit=dev
ENV PATH /opt/node_modules/.bin:$PATH
WORKDIR /opt/app
COPY . .

RUN npm run build

# Run
FROM node:18-alpine as production
RUN apk add --no-cache vips-dev
ENV NODE_ENV=production

WORKDIR /opt/
COPY --from=build /opt/node_modules ./node_modules
WORKDIR /opt/app
COPY --from=build /opt/app ./
ENV PATH /opt/node_modules/.bin:$PATH

RUN chown -R node:node /opt/app
USER node
EXPOSE 3000
CMD ["npm", "run", "start"]

⛔️ Error log

When uploading a file, the following error is thrown.

🕵️‍♀️ Stack trace

error: VipsOperation: class "heifsave_buffer" not found
Error: VipsOperation: class "heifsave_buffer" not found
node:events:495
throw er; // Unhandled 'error' event

🙇‍♀️ Expected behavior/code

No error

👩‍💻 Environment

📺 Additional context/Screenshots

I'm wondering if there is something else that needs to be installed when converting images to avif and webp using the strapi-responsive-image plugin/

Eventyret commented 8 months ago

Make sure viplibs is installed on the host as it uses th host to compile this.

Not the dockerfile issue rather the host needs this. Same in a Mac

ainsleyclark commented 8 months ago

Thanks for your reply @Eventyret

Would you mind pointing me in the right direction to install this on the host? I don't know if I can control that considering it's on Digital Ocean?

Eventyret commented 8 months ago

If it's a droplet Then the sharp docs helps with this https://sharp.pixelplumbing.com/install#custom-prebuilt-binaries

Post of the os

ainsleyclark commented 8 months ago

It's on App Platform 🤔

ainsleyclark commented 8 months ago

Anyone stumbling across this adding libheif-dev works:

RUN apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev libheif-dev > /dev/null 2>&1  # Add libheif-dev for HEIF support