8000 feat: add build for magento development · pnlinh/docker-php@883dab1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 883dab1

Browse files
committed
feat: add build for magento development
1 parent 12f5b18 commit 883dab1

File tree

9 files changed

+46
-23
lines changed

9 files changed

+46
-23
lines changed

README.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,54 @@
11
# Docker PHP-FPM & Nginx base on Alpine Linux
22

3-
Simple docker image for PHP development
3+
Simple docker image for Magento development
44

55
### How to use
66

7-
- First, build image
7+
- Build image
88

99
```shell
10-
./build 74 # Build docker php image for php 7.4
11-
./build 80 # Build docker php image for php 8.0
12-
./build 81 # Build docker php image for php 8.1
10+
./build php7.2 # Build image with php 7.4
11+
./build php7.4 # Build image with php 7.4
12+
./build php8.0 # Build image with php 8.0
13+
./build php8.1 # Build image with php 8.1
1314
```
1415

1516
- Mount your code to be served with container
1617

1718
```shell
18-
docker run --name=app -v /path/to/project:/var/www/html -p 80:80 pnlinh/php:74
19-
docker run --name=app -v /path/to/project:/var/www/html -p 80:80 pnlinh/php:80
20-
docker run --name=app -v /path/to/project:/var/www/html -p 80:80 pnlinh/php:81
19+
docker run --name=app -v /path/to/project:/var/www/html -p 80:80 pnlinh/magento:php7.4
20+
docker run --name=app -v /path/to/project:/var/www/html -p 80:80 pnlinh/magento:php8.0
21+
docker run --name=app -v /path/to/project:/var/www/html -p 80:80 pnlinh/magento:php8.1
22+
```
23+
24+
- With docker-compose
25+
26+
```
27+
version: '3.4'
28+
29+
services:
30+
app:
31+
image: pnlinh/magento:php7.4
32+
hostname: magento-app
33+
container_name: magento-app
34+
ports:
35+
- "80:80"
36+
volumes:
37+
- .:/var/www/html
38+
networks:
39+
- localnet
2140
```
2241

2342
- See PHP version info
2443

2544
```shell
26-
docker run --name=app --rm -p 80:80 pnlinh/php:74
27-
docker run --name=app --rm -p 80:80 pnlinh/php:80
28-
docker run --name=app --rm -p 80:80 pnlinh/php:81
45+
docker run --name=app --rm -p 80:80 pnlinh/magento:php7.4
46+
docker run --name=app --rm -p 80:80 pnlinh/magento:php8.0
47+
docker run --name=app --rm -p 80:80 pnlinh/magento:php8.1
2948
```
3049

3150
![image](https://user-images.githubusercontent.com/26193890/164198187-743e3585-1379-4d06-a2d5-34330b17d060.png)
3251

33-
### References
34-
- https://github.com/TrafeX/docker-php-nginx
52+
### References
53+
54+
- https://github.com/TrafeX/docker-php-nginx

build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env bash
22

3-
VERSIONS=("72" "74" "80" "81")
4-
IMAGE="pnlinh/php"
3+
TAGS=("php7.2" "php7.4" "php8.0" "php8.1")
4+
IMAGE="pnlinh/magento"
55

66
# shellcheck disable=SC2199
77
# shellcheck disable=SC2076
8-
if [[ ! " ${VERSIONS[@]} " =~ " $1 " ]]; then
8+
if [[ ! " ${TAGS[@]} " =~ " $1 " ]]; then
99
echo "Invalid version."
1010
exit 1
1111
fi
@@ -17,7 +17,7 @@ if [ $# -gt 0 ]; then
1717
echo "All done."
1818
exit 0
1919
fi
20-
docker build --no-cache -f "php$1".Dockerfile . -t ${IMAGE}:"$1"
20+
docker build --no-cache -f "$1".Dockerfile . -t ${IMAGE}:"$1"
2121
else
2222
echo "Nothing to build."
2323
fi

config/72/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ http {
3939
tcp_nodelay on;
4040
absolute_redirect off;
4141

42-
root /var/www/html/public;
42+
root /var/www/html;
4343
index index.php index.html;
4444

4545
location / {

config/80/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ http {
3939
tcp_nodelay on;
4040
absolute_redirect off;
4141

42-
root /var/www/html/public;
42+
root /var/www/html;
4343
index index.php index.html;
4444

4545
location / {

config/81/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ http {
3939
tcp_nodelay on;
4040
absolute_redirect off;
4141

42-
root /var/www/html/public;
42+
root /var/www/html;
4343
index index.php index.html;
4444

4545
location / {

php72.Dockerfile renamed to php7.2.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ ARG nginxGID=1000
7070

7171
RUN adduser -D -u ${nginxUID} -g ${nginxGID} -s /bin/sh www && \
7272
mkdir -p /var/www/html && \
73+
mkdir -p /var/www/html/tmp && \
7374
mkdir -p /var/cache/nginx && \
7475
chown -R www:www /var/www/html && \
7576
chown -R www:www /run && \
@@ -80,7 +81,7 @@ RUN adduser -D -u ${nginxUID} -g ${nginxGID} -s /bin/sh www && \
8081
USER www
8182

8283
# Add application
83-
COPY --chown=www src/ /var/www/html/public
84+
COPY --chown=www src/ /var/www/html
8485

8586
# Expose the port nginx is reachable on
8687
EXPOSE 80
File renamed without changes.

php80.Dockerfile renamed to php8.0.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ ARG nginxGID=1000
6868

6969
RUN adduser -D -u ${nginxUID} -g ${nginxGID} -s /bin/sh www && \
7070
mkdir -p /var/www/html && \
71+
mkdir -p /var/www/html/tmp && \
7172
mkdir -p /var/cache/nginx && \
7273
chown -R www:www /var/www/html && \
7374
chown -R www:www /run && \
@@ -78,7 +79,7 @@ RUN adduser -D -u ${nginxUID} -g ${nginxGID} -s /bin/sh www && \
7879
USER www
7980

8081
# Add application
81-
COPY --chown=www src/ /var/www/html/public
82+
COPY --chown=www src/ /var/www/html
8283

8384
# Expose the port nginx is reachable on
8485
EXPOSE 80

php81.Dockerfile renamed to php8.1.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ ARG nginxGID=1000
6868

6969
RUN adduser -D -u ${nginxUID} -g ${nginxGID} -s /bin/sh www && \
7070
mkdir -p /var/www/html && \
71+
mkdir -p /var/www/html/tmp && \
7172
mkdir -p /var/cache/nginx && \
7273
chown -R www:www /var/www/html && \
7374
chown -R www:www /run && \
@@ -78,7 +79,7 @@ RUN adduser -D -u ${nginxUID} -g ${nginxGID} -s /bin/sh www && \
7879
USER www
7980

8081
# Add application
81-
COPY --chown=www src/ /var/www/html/public
82+
COPY --chown=www src/ /var/www/html
8283

8384
# Expose the port nginx is reachable on
8485
EXPOSE 80

0 commit comments

Comments
 (0)
0