How to setup Phalcon 5 framework in a Docker container V2

setup Phalcon 5

How to setup Phalcon 5 framework in a Docker container V2

Views: 43
0 0
Read Time:1 Minute, 48 Second

In my previous article (https://brewedbrilliance.net/how-to-setup-phalcon-framework-in-a-docker-container/) I went through the steps needed for having a Dockerfile recipe ready to use for the phalcon framework and Apache based on Ubuntu. The end result was not so bad, however the docker image generated was around 8/900Mb that are good for a local development but wont be sustainable on the long run.

I managed to reduce the size down to ~300Mb, still big but improving, the Dockerfile is the follow

FROM alpine:latest
RUN apk add --no-cache \
    apache2-proxy \
    apache2-ssl \
    apache2-utils \
    curl \
    git \
    logrotate \
    openssl \
    git bash php php7-dev apache2 gcc \
    libc-dev make php7-pdo php7-json \
    php7-session php7-pecl-psr \
    php7-apache2

RUN git clone --depth=1 "git://github.com/phalcon/cphalcon.git"
WORKDIR cphalcon/build
RUN ./install
RUN echo "extension=phalcon.so" > /etc/php7/conf.d/phalcon.ini
RUN rm -rf /cphalcon

RUN apk del libc-dev zlib-dev php7-dev libedit-dev musl-dev pcre2-dev ncurses-dev \
        expat xz-libs curl musl-utils make libedit zlib ncurses-libs libstdc++ pcre git bash musl argon2-libs
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2

WORKDIR /var/www/localhost/htdocs
RUN echo "<?php phpinfo(); ?>" >  /var/www/localhost/htdocs/index.php

EXPOSE 80

CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]

The above dockerfile is dealing with Phalcon version 5 that is still in beta, if you want something more stable in a dev environment that will include Apache, PHP7 and Phalcon 4 then please visit this link

If you are interested in how to setup a Phalcon project step by step follow this link https://brewedbrilliance.net/phalcon-project-from-scratch-step-by-step/

If you enjoyed this article please share and help us grow.

Learning PHP – Introduction

Learning PHP – print and echo

Learning PHP – The variables

Learning PHP – if else

Learning PHP – Arrays

Learning PHP – The loops

Learning PHP – The Functions

happy How to setup Phalcon 5 framework  in a Docker container V2
Happy
0 %
sad How to setup Phalcon 5 framework  in a Docker container V2
Sad
0 %
excited How to setup Phalcon 5 framework  in a Docker container V2
Excited
0 %
sleepy How to setup Phalcon 5 framework  in a Docker container V2
Sleepy
0 %
angry How to setup Phalcon 5 framework  in a Docker container V2
Angry
0 %
surprise How to setup Phalcon 5 framework  in a Docker container V2
Surprise
0 %

Share this content:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x