Dev environment in Docker with Apache + PHP7 + Phalcon

Views: 11
0 0
Read Time:1 Minute, 50 Second

Use this docker recipe if you want to setup your small dev environment in Docker with Apache + PHP7 + Phalcon. The dockerfile below is going through some basic steps that will consists in

Installing apache and some other utils like git, curl, openssl and install the php bin and libraries needed for downloading and compiling phalcon framework. After that is enabling the mod_rewrite and after that remove the unnecessary binaries.

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 
WORKDIR /
RUN git clone "https://github.com/phalcon/cphalcon.git"
WORKDIR /cphalcon/build
RUN git checkout v4.1.3
RUN ./install
RUN echo "extension=phalcon.so" > /etc/php7/conf.d/phalcon.ini
RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/httpd.conf
RUN sed -i 's/AllowOverride none/AllowOverride All/g' /etc/apache2/httpd.conf
RUN sed -i 's/#LoadModule rewrite_module modules\/mod_rewrite.so/LoadModule rewrite_module modules\/mod_rewrite.so/g' /etc/apache2/httpd.conf

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"]

All you need to do is to run this command

docker build -t my-dev-env-phalcon4 .

Enjoy

Git repo url https://github.com/keep4yourself/phalcon-dev-env

If you are interested in how to setup a Phalcon project step by step follow this link https://keepforyourself.com/coding/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

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
Previous post Learning PHP – Lesson 4 – Learn PHP Arrays
Next post Phalcon project from scratch step by step
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x