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
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
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";
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us