1#index.php
2<?php
3
4echo "Hello world";
5
6#Dockerfile
7FROM php:7.4-cli
8COPY . /usr/src/cli
9WORKDIR /usr/src/cli
10CMD [ "php", "./index.php" ]
11
12
13then Run => docker build -t cli .
14then Run => docker run -it cli
1#Dockerfile
2FROM php:7.4-cli as cli
3
4RUN apt-get update && apt-get install -y git unzip curl
5
6# Install Composer
7RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
8RUN composer --version
9
10
11FROM cli
12COPY . /var/www/
13WORKDIR /var/www/
14
15RUN composer install
16
17#makefile
18build:
19 docker build -t cli .
20 docker start cli
21
22bash:
23 docker exec -it cli bash
24
25stop:
26 docker stop cli
27
28destroy:
29 docker rm cli
30
31 #index.php
32<?php
33
34echo "Hello world";