Answers for "dockerfile php cli"

PHP
0

php-cli docker example

#index.php
<?php

echo "Hello world";

#Dockerfile
FROM php:7.4-cli
COPY . /usr/src/cli
WORKDIR /usr/src/cli
CMD [ "php", "./index.php" ]


then Run => docker build -t cli .
then Run => docker run -it cli
Posted by: Guest on February-13-2021
0

dockerfile php cli

#Dockerfile
FROM php:7.4-cli as cli

RUN apt-get update && apt-get install -y git unzip curl

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer --version


FROM cli
COPY . /var/www/
WORKDIR /var/www/

RUN composer install
  
#makefile
build:
	docker build -t cli .
	docker start cli

bash:
	docker exec -it cli  bash

stop:
	docker stop cli

destroy:
	docker rm cli

 #index.php
<?php

echo "Hello world";
Posted by: Guest on June-17-2021

Browse Popular Code Answers by Language