Skip to content

Commit 7e6b9d6

Browse files
committed
Add new images with php 7.4 and php 7.8
1 parent db349ee commit 7e6b9d6

4 files changed

Lines changed: 132 additions & 2 deletions

File tree

Dockerfile-php7.4

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
FROM php:7.4-apache
2+
3+
LABEL maintainer="Antonio Sanna <[email protected]>"
4+
5+
RUN apt-get update
6+
RUN apt-get upgrade -y
7+
8+
RUN apt-get install --fix-missing -y libpq-dev
9+
RUN apt-get install --no-install-recommends -y libpq-dev
10+
RUN apt-get install -y libxml2-dev libbz2-dev zlib1g-dev
11+
RUN apt-get -y install libsqlite3-dev libsqlite3-0 mariadb-client curl exif ftp
12+
RUN docker-php-ext-install intl
13+
RUN docker-php-ext-install mysqli pdo pdo_mysql
14+
RUN docker-php-ext-enable mysqli
15+
RUN docker-php-ext-enable pdo
16+
RUN docker-php-ext-enable pdo_mysql
17+
RUN apt-get -y install --fix-missing zip unzip
18+
RUN apt-get -y install --fix-missing git
19+
20+
# Composer
21+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
22+
RUN composer self-update --2
23+
24+
ADD conf/apache.conf /etc/apache2/sites-available/000-default.conf
25+
26+
# LDAP INSTALLATION
27+
RUN set -x \
28+
&& apt-get update \
29+
&& apt-get install -y libldap2-dev \
30+
&& rm -rf /var/lib/apt/lists/* \
31+
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
32+
&& docker-php-ext-install ldap \
33+
&& apt-get purge -y --auto-remove libldap2-dev
34+
35+
RUN a2enmod rewrite
36+
37+
#ADD startScript.sh /startScript.sh
38+
# The printf command below creates the script /startScript.sh with the following 3 lines.
39+
# #!/bin/bash
40+
# mv /codeigniter4 /var/www/html
41+
# /usr/sbin/apache2ctl -D FOREGROUND
42+
RUN printf "#!/bin/bash\nmv /codeigniter4 /var/www/html\n/usr/sbin/apache2ctl -D FOREGROUND" > /startScript.sh
43+
RUN chmod +x /startScript.sh
44+
45+
RUN cd /var/www/html
46+
47+
RUN composer create-project codeigniter4/appstarter codeigniter4 v4.1.5
48+
RUN chmod -R 0777 /var/www/html/codeigniter4/writable
49+
50+
RUN mv codeigniter4 /
51+
52+
RUN apt-get clean \
53+
&& rm -r /var/lib/apt/lists/*
54+
55+
EXPOSE 80
56+
VOLUME ["/var/www/html", "/var/log/apache2", "/etc/apache2"]
57+
58+
CMD ["bash", "/startScript.sh"]

Dockerfile-php8.0

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
FROM php:8.0-apache
2+
3+
LABEL maintainer="Antonio Sanna <[email protected]>"
4+
5+
RUN apt-get update
6+
RUN apt-get upgrade -y
7+
8+
RUN apt-get install --fix-missing -y libpq-dev
9+
RUN apt-get install --no-install-recommends -y libpq-dev
10+
RUN apt-get install -y libxml2-dev libbz2-dev zlib1g-dev
11+
RUN apt-get -y install libsqlite3-dev libsqlite3-0 mariadb-client curl exif ftp
12+
RUN docker-php-ext-install intl
13+
RUN docker-php-ext-install mysqli pdo pdo_mysql
14+
RUN docker-php-ext-enable mysqli
15+
RUN docker-php-ext-enable pdo
16+
RUN docker-php-ext-enable pdo_mysql
17+
RUN apt-get -y install --fix-missing zip unzip
18+
RUN apt-get -y install --fix-missing git
19+
20+
# Composer
21+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
22+
RUN composer self-update --2
23+
24+
ADD conf/apache.conf /etc/apache2/sites-available/000-default.conf
25+
26+
# LDAP INSTALLATION
27+
RUN set -x \
28+
&& apt-get update \
29+
&& apt-get install -y libldap2-dev \
30+
&& rm -rf /var/lib/apt/lists/* \
31+
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
32+
&& docker-php-ext-install ldap \
33+
&& apt-get purge -y --auto-remove libldap2-dev
34+
35+
RUN a2enmod rewrite
36+
37+
#ADD startScript.sh /startScript.sh
38+
# The printf command below creates the script /startScript.sh with the following 3 lines.
39+
# #!/bin/bash
40+
# mv /codeigniter4 /var/www/html
41+
# /usr/sbin/apache2ctl -D FOREGROUND
42+
RUN printf "#!/bin/bash\nmv /codeigniter4 /var/www/html\n/usr/sbin/apache2ctl -D FOREGROUND" > /startScript.sh
43+
RUN chmod +x /startScript.sh
44+
45+
RUN cd /var/www/html
46+
47+
RUN composer create-project codeigniter4/appstarter codeigniter4 v4.1.5
48+
RUN chmod -R 0777 /var/www/html/codeigniter4/writable
49+
50+
RUN mv codeigniter4 /
51+
52+
RUN apt-get clean \
53+
&& rm -r /var/lib/apt/lists/*
54+
55+
EXPOSE 80
56+
VOLUME ["/var/www/html", "/var/log/apache2", "/etc/apache2"]
57+
58+
CMD ["bash", "/startScript.sh"]

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
This repository provides you a development environment without requiring you to install PHP, a web server, and any other server software on your local machine. For this, it requires Docker and Docker Compose.
77

8-
Basic example to create your container (tested on Ubuntu 18.04 - Docker version 19.03.5, build 633a0ea838):
8+
Basic example to create your container (tested on Ubuntu 20.04 - Docker version 20.10.11, build dea9396 - docker-compose version 1.25.0 ):
99

1010
**NOTE: This package is under early development and is not ready for prime-time.**
1111

@@ -34,13 +34,25 @@ start the container:
3434
docker container run -it --publish 80:80 --name ci4 -v /localfolder:/var/www/html codeigniter:4.1.5
3535
```
3636

37+
## Build image with PHP 7.4
38+
```
39+
docker build -f Dockerfile-php7.4 -t codeigniter:4.1.5 .
40+
```
41+
42+
## Build image with PHP 8.0
43+
```
44+
docker build -f Dockerfile-php8.0 -t codeigniter:4.1.5 .
45+
```
46+
3747
## Installation
3848

3949
1. Install [docker](https://docs.docker.com/engine/installation/) and [docker-compose](https://docs.docker.com/compose/install/) ;
4050

4151
2. Copy `docker-compose.yml` file to your project root path, and edit it according to your needs ;
4252

43-
3. From your project directory, start up your application by running:
53+
3. Uncomment, in the `docker-compose.yml` file, the image you want to use it ;
54+
55+
4. From your project directory, start up your application by running:
4456

4557
```sh
4658
docker-compose up -d

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ services:
88
#--------------------------------------------------------------------------#
99
codeigniter4:
1010
image: atsanna/codeigniter4:latest
11+
# image: atsanna/codeigniter4:v4.1.5-php7.4
12+
# image: atsanna/codeigniter4:v4.1.5-php8.0
1113
container_name: 'codeigniter4'
1214
ports:
1315
- 80:80

0 commit comments

Comments
 (0)