Ask questionsphp build fails when cache is enabled
Adding --mount=type=cache,id=apk,sharing=locked,target=/var/cache/apk ln -vs /var/cache/apk /etc/apk/cache && \
to the following Dockerfile, makes it failt to build on linux
Funny enough works fine on macos
#32 9.570 checking for icu-config... no
#32 9.571 checking for location of ICU headers and libraries... not found
#32 9.571 configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
#32 [php70 13/15] RUN --mount=type=cache,id=apk,sharing=locked,target=/var/c...
#32 ERROR: executor failed running [/bin/sh -c apk add --update --virtual .build-deps $PHPIZE_DEPS && docker-php-ext-configure bcmath --enable-bcmath && docker-php-ext-configure intl --enable-intl && docker-php-ext-configure pcntl --enable-pcntl && docker-php-ext-configure pdo_mysql --with-pdo-mysql && docker-php-ext-configure mbstring --enable-mbstring && docker-php-ext-configure soap --enable-soap]: exit code: 1
#17 [nginx-base 5/5] RUN --mount=type=cache,id=wheel,sharing=locked,target=/...
#17 CANCELED
# syntax=docker/dockerfile:experimental
FROM php:7.0-fpm-alpine AS php70
WORKDIR /var/www
RUN adduser -DHSu 100 nginx -s /sbin/nologin
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
COPY ./opcache.ini /usr/local/etc/php-fpm.d/opcache.ini
RUN --mount=type=cache,id=apk,sharing=locked,target=/var/cache/apk ln -vs /var/cache/apk /etc/apk/cache && \
apk add --update --virtual build-dependencies \
$PHPIZE_DEPS \
autoconf \
automake \
build-base \
cmake \
curl-dev \
file \
g++ \
gcc \
gettext-dev \
git \
icu-dev \
libc-dev \
libmcrypt-dev \
libpng-dev \
libressl-dev \
libtool \
libxml2-dev \
libxslt-dev \
make \
nasm \
pcre-dev \
pkgconf \
re2c \
sqlite-dev \
wget \
zlib-dev
# syntax=docker/dockerfile:experimental
FROM php:7.0-fpm-alpine AS php70
WORKDIR /var/www
RUN adduser -DHSu 100 nginx -s /sbin/nologin
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
COPY ./opcache.ini /usr/local/etc/php-fpm.d/opcache.ini
RUN apk add --update --virtual build-dependencies \
$PHPIZE_DEPS \
autoconf \
automake \
build-base \
cmake \
curl-dev \
file \
g++ \
gcc \
gettext-dev \
git \
icu-dev \
libc-dev \
libmcrypt-dev \
libpng-dev \
libressl-dev \
libtool \
libxml2-dev \
libxslt-dev \
make \
nasm \
pcre-dev \
pkgconf \
re2c \
sqlite-dev \
wget \
zlib-dev
macos
Client: Docker Engine - Community
Version: 19.03.1
API version: 1.40
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:18:17 2019
OS/Arch: darwin/amd64
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 19.03.1
API version: 1.40 (minimum version 1.12)
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:17:52 2019
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: v1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
Ubuntu 19.04
Client: Docker Engine - Community
Version: 19.03.1
API version: 1.40
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:21:22 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.1
API version: 1.40 (minimum version 1.12)
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:19:53 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
Answer
questions
FernandoMiguel
> [php70 13/15] RUN --mount=type=cache,id=apk,sharing=locked,target=/var/cache/apk apk add --update --virtual .build-deps autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c
------
Error: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to build LLB: executor failed running [/bin/sh -c apk add --update --virtual .build-deps $PHPIZE_DEPS]: exit code: 1
Usage:
/usr/libexec/docker/cli-plugins/docker-buildx bake [OPTIONS] [TARGET...] [flags]
Related questions