Press "Enter" to skip to content

单docker部署ThinkPHP或者laravel

Laravel

# Dockerfile
FROM php:7.2-cli

RUN apt-get update -y && apt-get install -y libmcrypt-dev

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-install pdo mbstring

WORKDIR /app
COPY . /app

RUN composer install

EXPOSE 8000
CMD php artisan serve --host=0.0.0.0 --port=8000
$ cd
$ docker build -t laravel-tutorial .
$ docker run -it -p 8000:8000 laravel-tutorial

ThinkPHP

FROM php:7.3.0-apache
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y libzip-dev libxml2-dev libgmp-dev libsodium-dev libpng-dev vim --allow-unauthenticated

RUN docker-php-ext-install gd
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

WORKDIR /app
COPY . /app

RUN composer install

EXPOSE 8000
CMD php think run --host=0.0.0.0 --port=8000
$ cd
$ docker build -t thinkphp .
$ docker run -it -p 8000:8000 thinkphp 

参考资料:

https://dockerize.io/guides/php-laravel-guide

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注