'dockerizing Laravel + vue
Trying to migrate my Laravel and Vue code into docker but I am getting an error building the Image
This is my docker file
# dockerfile
FROM php:8-fpm
# Copy composer.lock and composer.json
COPY ./composer.lock* ./composer.json* /var/www/
# Set working directory
WORKDIR /var/www
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
locales \
zip \
jpegoptim optipng pngquant gifsicle \
unzip \
curl
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install extensions
#RUN apt-get install -y libzip-dev zlib1g-dev
RUN docker-php-ext-install pdo pdo_mysql zip gd pcntl opcache bcmath
#RUN docker-php-ext-install pdo pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd
RUN pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# NPM for frontend builds
#RUN apt install nodejs npm -y
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
#RUN apt-get install nodejs -y
# Add user for laravel application
RUN groupadd -g 1000 www
RUN useradd -u 1000 -ms /bin/bash -g www www
# Copy existing application directory contents
COPY ./corambackend /var/www
# Copy existing application directory permissions
COPY --chown=www:www . /var/www
#COPY httpd.conf /etc/httpd/conf/httpd.conf
# Change current user to www
USER www
# Expose port 9000 and start php-fpm server
EXPOSE 80
CMD ["php-fpm"]
and the error I'm getting is
#10 37.43 checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20210902
#10 37.43 checking for PHP installed headers prefix... /usr/local/include/php
#10 37.43 checking if debug is enabled... no
#10 37.44 checking if zts is enabled... no
#10 37.46 checking for gawk... no
#10 37.46 checking for nawk... nawk
#10 37.46 checking if nawk is broken... no
#10 37.46 checking for zip archive read/write support... yes, shared
#10 37.47 checking for libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0... no
#10 37.47 configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
#10 37.47
#10 37.47 No package 'libzip' found
#10 37.47 No package 'libzip' found
#10 37.47 No package 'libzip' found
#10 37.47
#10 37.47 Consider adjusting the PKG_CONFIG_PATH environment variable if you
#10 37.47 installed software in a non-standard prefix.
#10 37.47
#10 37.47 Alternatively, you may set the environment variables LIBZIP_CFLAGS
#10 37.47 and LIBZIP_LIBS to avoid the need to call pkg-config.
#10 37.47 See the pkg-config man page for more details.
------
executor failed running [/bin/sh -c docker-php-ext-install pdo pdo_mysql zip gd pcntl opcache bcmath]: exit code: 1
I try adding
RUN apt-get install -y \
libzip-dev \
zip \
&& docker-php-ext-install zip
but it did not work. If anyone can help out with the docker file or can point me to a good resource do dockerizing Laravel + vue with php 8.
Solution 1:[1]
I think the reason is that you cleared all the cache in apt, you need to add the line RUN apt-get update
again to install the package.
RUN apt-get update && apt-get install -y \
libzip-dev \
zip \
&& docker-php-ext-install zip
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | duy nguy?n tích |