We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Docker and Phalcon

Hi, try to install phalcon on standard image.

FROM php:7.2-fpm

RUN apt-get update -yqq

RUN apt-get install -y zlib1g-dev libpng-dev libjpeg-dev

RUN docker-php-ext-install -j$(nproc) gettext pdo_mysql \
    && docker-php-ext-configure gd --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd

RUN curl -s "https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh" | bash \
    && apt-get clean \
    && apt-get update -yqq

RUN phpize -v

RUN apt-get install -y php7.2-phalcon=3.4.1-1+php7.2

logs during build

Step 6/7 : RUN phpize -v
 ---> Running in 98c506d23ea9
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
Removing intermediate container 98c506d23ea9
 ---> dacc93586b31
Step 7/7 : RUN apt-get install -y php7.2-phalcon=3.4.1-1+php7.2
 ---> Running in dc466ffb0a12
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.2-phalcon : Depends: phpapi-20170718 but it is not installable
E: Unable to correct problems, you have held broken packages.
ERROR: Service 'php' failed to build: The command '/bin/sh -c apt-get install -y php7.2-phalcon=3.4.1-1+php7.2' returned a non-zero code: 100

please help my, I don't have any idea how fix this.



17.5k

Try my Dockckerfile

FROM phpdockerio/php72-fpm:latest
WORKDIR "/application"

# Fix debconf warnings upon build
ARG DEBIAN_FRONTEND=noninteractive

# Install selected extensions and other stuff
RUN apt-get update \
&& apt-get -y --no-install-recommends install  php7.2-mysql php-redis php-xdebug php7.2-bcmath php7.2-bz2 php7.2-gd php7.2-intl php-ssh2 php7.2-xsl php-yaml \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# Install phalcon
RUN curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | bash \
&& apt-get install -y php7.2-phalcon=3.4.2-2+php7.2 \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# Install git
RUN apt-get update \
&& apt-get -y install git \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# Phalcon dev tools
RUN cd ~  && git clone git://github.com/phalcon/phalcon-devtools.git \
&& cd phalcon-devtools/ && ./phalcon.sh \
&& ln -s ~/phalcon-devtools/phalcon.php /usr/bin/phalcon  \
&& chmod ugo+x /usr/bin/phalcon

You can try this, be aware that this is apache version and the phalcon version i 3.3.1

FROM php:7.2-apache

LABEL maintainer="Mads Mønster @storebuddy.dk"
LABEL version="1.0"

RUN apt-get update && apt-get install -y \
    cron \
    anacron \
    git \
    libpcre3-dev \
    libmcrypt-dev \
    libxml2-dev \
    zlib1g-dev \
    libssh2-1 \
    libssh2-1-dev \
    libpng-dev \
    --no-install-recommends \
    && docker-php-ext-install -j$(nproc) pdo_mysql mbstring soap zip gd \
    && cp /usr/local/bin/php /usr/bin/

# Install PECL extensions
RUN pecl install xdebug && pecl install mcrypt-1.0.1 && pecl install ssh2-1.1.2
RUN docker-php-ext-enable xdebug mcrypt ssh2

# Install Phalcon
WORKDIR /usr/local/src
RUN git clone https://github.com/phalcon/cphalcon.git --branch v3.3.1 --single-branch
WORKDIR /usr/local/src/cphalcon/build
RUN ./install

WORKDIR /etc/php7/mods-available
RUN echo 'extension=phalcon.so' >> phalcon.ini
RUN docker-php-ext-enable phalcon

WORKDIR /var/www/

@moledat thanks! That did the trick for me. Removed a couple of extraneous dependencies and she's good to go!

Try my Dockckerfile

FROM phpdockerio/php72-fpm:latest
WORKDIR "/application"

# Fix debconf warnings upon build
ARG DEBIAN_FRONTEND=noninteractive

# Install selected extensions and other stuff
RUN apt-get update \
&& apt-get -y --no-install-recommends install  php7.2-mysql php-redis php-xdebug php7.2-bcmath php7.2-bz2 php7.2-gd php7.2-intl php-ssh2 php7.2-xsl php-yaml \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# Install phalcon
RUN curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | bash \
&& apt-get install -y php7.2-phalcon=3.4.2-2+php7.2 \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# Install git
RUN apt-get update \
&& apt-get -y install git \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# Phalcon dev tools
RUN cd ~  && git clone git://github.com/phalcon/phalcon-devtools.git \
&& cd phalcon-devtools/ && ./phalcon.sh \
&& ln -s ~/phalcon-devtools/phalcon.php /usr/bin/phalcon  \
&& chmod ugo+x /usr/bin/phalcon