Home >Backend Development >Golang >Install libvips on golang docker container

Install libvips on golang docker container

WBOY
WBOYforward
2024-02-09 19:33:091072browse

在 golang docker 容器上安装 libvips

#php editor Strawberry will introduce to you how to install libvips on the golang docker container. libvips is a fast and efficient image processing library that can be used in various application scenarios. In docker containers built with golang, installing libvips can provide powerful support for image processing. This article will introduce in detail the steps and precautions for installing libvips. I hope it will be helpful to everyone.

Question content

How to install libvips on a Docker container.

Solution

My opinion on this.

FROM ubuntu:20.04
    
    RUN mkdir /app
            
    COPY imgApp /app
    
    ARG DEBIAN_FRONTEND=noninteractive
    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
    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 \
            gettext 
    
    ARG VIPS_VER=8.14.2
    ARG VIPS_DLURL=https://github.com/libvips/libvips/releases/download
    RUN 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
    RUN ldconfig
            
    RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/vips/lib

Hope someone can do better in the future.

The above is the detailed content of Install libvips on golang docker container. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete