The following error was output when executing codecept -c src run acceptance
command on alpine linux:
none
base64: unrecognized option: w
BusyBox v1.30.1 (2019-06-12 17:51:55 UTC) multi-call binary.Usage: base64 [-d] [FILE]
Base64 encode or decode FILE to standard output
-d Decode data
I can’t see the command being executed by codecept.
I tried to add base64 in apk but base64 did not exist.
Dockerfile:
FROM node:10-alpine AS node
FROM php:7.1-fpm-alpine
ENV GITHUB_OAUTH_TOKEN test
ENV COMPOSER_ASSET_VERSION 1.3.1
ENV DOCKERIZE_VERSION v0.6.1
ENV PATH=~/.composer/vendor/bin:$PATH
# install packages
RUN apk add -U --no-cache
curl-dev
libxml2-dev
libpng-dev
libjpeg-turbo-dev
zip
libzip-dev
unzip
gmp-dev
python
make
autoconf
memcached-dev
libmemcached-dev
libmcrypt-dev
icu-dev
g++
RUN pecl install xdebug
memcached
# install PHP extensions
RUN docker-php-source extract
&& cp /usr/src/php/ext/openssl/config0.m4 /usr/src/php/ext/openssl/config.m4
RUN docker-php-ext-configure gd --with-png-dir=/usr/include --with-jpeg-dir=/usr/include
&& docker-php-ext-configure soap --enable-soap
RUN docker-php-ext-install
pdo
pdo_mysql
mysqli
mbstring
mcrypt
xml
intl
opcache
gd
soap
zip
&& docker-php-ext-enable xdebug
memcached
# install composer
RUN curl -sS https://getcomposer.org/installer | php
&& mv composer.phar /usr/local/bin/composer
# install composer plugin
RUN composer global require hirak/prestissimo
&& composer config --global github-oauth.github.com $GITHUB_OAUTH_TOKEN
&& composer config -g repos.packagist composer https://packagist.jp
&& composer global require fxp/composer-asset-plugin:^$COMPOSER_ASSET_VERSION
# install dockerize
#RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
# && tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
#&& rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
# add node.js npm
COPY --from=node /usr/local /usr/local
RUN mkdir -p /project/test
WORKDIR /project/test
CMD ["php-fpm"]
#RUN rm /usr/local/bin/yarn /usr/local/bin/yarnpkg
2
Answers
The
alpine
images seem to have a version ofbase64
which doesn’t provide the-w
option:but if you execute
apk add --update coreutils
it’s there:If you’re going to install a full C++ toolchain, and also Python, and also several C libraries’ development files, all on top of a PHP base image, you will wind up with a fairly large image. (And if you go with @tgogos’s answer and install a duplicate copy of core Linux system tools, even bigger.)
The space savings you’re getting from an Alpine vs. Debian base image are pretty minimal compared to this giant pile of stuff you’re installing. If you change this to an Debian base then you’ll have all of the extensions the GNU versions of these tools make available. (You’ll also have to change
apk add
toapt-get install
and find the corresponding Ubuntu package names, but in most cases these are pretty similar.) I’d suggest changing: