I am attempting to build an image inside a Bitbucket Pipeline.
Inside a docker:stable container, I run the following:
export DOCKER_BUILDKIT=1
docker build --ssh default --no-cache -t worker $BITBUCKET_CLONE_DIR/worker
And I receive the following error:
docker build --ssh default --no-cache -t worker $BITBUCKET_CLONE_DIR/worker
#1 [internal] load build definition from Dockerfile
#1 digest: sha256:0cd265ebdafcc2f1032a29fe3abd3b7bfdf9b2b7d8728d102891147ca12085ff
#1 name: "[internal] load build definition from Dockerfile"
#1 started: 2019-04-23 13:55:38.983901934 +0000 UTC
#1 completed: 2019-04-23 13:55:38.984013738 +0000 UTC
#1 duration: 111.804µs
#1 started: 2019-04-23 13:55:38.984118825 +0000 UTC
#1 completed: 2019-04-23 13:55:38.985692776 +0000 UTC
#1 duration: 1.573951ms
#1 error: "no active session for mk69gwxmeuqzy4m0n6zvckl7s: context canceled: context canceled"
#2 [internal] load .dockerignore
#2 digest: sha256:8e4fd466f415b284ba7b7fda6977cc8c241f501213393f98a86ad00ffd1aab99
#2 name: "[internal] load .dockerignore"
#2 started: 2019-04-23 13:55:38.984039837 +0000 UTC
#2 completed: 2019-04-23 13:55:38.984091972 +0000 UTC
#2 duration: 52.135µs
#2 started: 2019-04-23 13:55:38.98417841 +0000 UTC
#2 completed: 2019-04-23 13:55:38.985694195 +0000 UTC
#2 duration: 1.515785ms
#2 error: "no active session for mk69gwxmeuqzy4m0n6zvckl7s: context canceled: context canceled"
failed to dial gRPC: unable to upgrade to h2c, received 403
My Dockerfile is as follows:
# syntax=docker/dockerfile:1.0.0-experimental
FROM composer:1.7 as phpdep
COPY application/database/ database/
COPY application/composer.json composer.json
COPY application/composer.lock composer.lock
# Install PHP dependencies in 'vendor'
RUN --mount=type=ssh composer install \
--ignore-platform-reqs \
--no-dev \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist
#
# Final image build stage
#
FROM alpine-base:latest as final
ADD application /app/application
COPY --from=phpdep /app/vendor/ /app/application/vendor/
ADD entrypoint.sh /entrypoint.sh
RUN \
apk update && \
apk upgrade && \
apk add \
php7 php7-mysqli php7-mcrypt php7-gd \
php7-curl php7-xml php7-bcmath php7-mbstring \
php7-zip php7-bz2 ca-certificates php7-openssl php7-zlib \
php7-bcmath php7-dom php7-json php7-phar php7-pdo_mysql php7-ctype \
php7-session php7-fileinfo php7-xmlwriter php7-tokenizer php7-soap \
php7-simplexml && \
cd /app/application && \
cp .env.example .env && \
chown nobody:nobody /app/application/.env && \
sed -i 's/;openssl.capath=/openssl.capath=\/etc\/ssl\/certs/' /etc/php7/php.ini && \
sed -i 's/memory_limit = 128M/memory_limit = 1024M/' /etc/php7/php.ini && \
apk del --purge curl wget && \
mkdir -p /var/log/workers && \
mkdir -p /run/php && \
echo "export PS1='WORKER \h:\w\$ '" >> /etc/profile
COPY files/logrotate.d/ /etc/logrotate.d/
CMD ["/entrypoint.sh"]