日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
怎么使用Docker部署Laravel應(yīng)用

本文小編為大家詳細(xì)介紹“怎么使用Docker部署Laravel應(yīng)用”,內(nèi)容詳細(xì),步驟清晰,細(xì)節(jié)處理妥當(dāng),希望這篇“怎么使用Docker部署Laravel應(yīng)用”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來(lái)學(xué)習(xí)新知識(shí)吧。

創(chuàng)新互聯(lián)專注于合作企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站設(shè)計(jì),商城網(wǎng)站建設(shè)。合作網(wǎng)站建設(shè)公司,為合作等地區(qū)提供建站服務(wù)。全流程按需策劃,專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)

一、 準(zhǔn)備我們的 laravel 應(yīng)用

# 運(yùn)行 mix 命令,打包 js、css、img 文件,如果沒(méi)有用到 mix 這一步可以省略
npm install
npm run production
# 安裝 composer.lock 中的依賴
composer install --ignore-platform-reqs --optimize-autoloader --no-dev

二、 準(zhǔn)備 apache 配置文件 docker/000-default.conf


 # the servername directive sets the request scheme, hostname and port that
 # the server uses to identify itself. this is used when creating
 # redirection urls. in the context of virtual hosts, the servername
 # specifies what hostname must appear in the request's host: header to
 # match this virtual host. for the default virtual host (this file) this
 # value is not decisive as it is used as a last resort host regardless.
 # however, you must set it for any further virtual host explicitly.
 #servername www.example.com

 serveradmin liuzhaowei55@gmail.com
 documentroot /var/www/html/public

 # available loglevels: trace8, ..., trace1, debug, info, notice, warn,
 # error, crit, alert, emerg.
 # it is also possible to configure the loglevel for particular
 # modules, e.g.
 #loglevel info ssl:warn

 errorlog ${apache_log_dir}/error.log
 customlog ${apache_log_dir}/access.log combined

 # for most configuration files from conf-available/, which are
 # enabled or disabled at a global level, it is possible to
 # include a line for only one particular virtual host. for example the
 # following line enables the cgi configuration for this host only
 # after it has been globally disabled with "a2disconf".
 #include conf-available/serve-cgi-bin.conf

三、 準(zhǔn)備 dockerfile 文件

from php:7.3-apache

label maintainer="liuzhaowei55@gmail.com"

# 設(shè)置時(shí)區(qū)
arg tz=asia/shanghai
env tz ${tz}
run ln -snf /usr/share/zoneinfo/$tz /etc/localtime && echo $tz > /etc/timezone

# 安裝軟件 cron
run set -eux \
 && apt-get update \
 && apt-get install -y --no-install-recommends cron \
 && apt-get autoremove \
 && apt-get autoclean \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 
# 安裝拓展
env php_extension \
 pdo_MySQL \
 bcmath
env pecl_extension \
 redis
run docker-php-ext-install $php_extension \
 && pecl install $pecl_extension \
 && docker-php-ext-enable $pecl_extension \
    opcache \
 && a2enmod rewrite
 
# 訪問(wèn)端口
expose 80

arg app_env=development
env app_env ${app_env}

copy --chown=www-data:www-data . /var/www/html
copy docker/000-default.conf /etc/apache2/sites-available/000-default.conf
workdir /var/www/html

四、準(zhǔn)備 dockerignore 文件:.dockerignore(非必需)

/node_modules
/.dockerignore
/dockerfile

五、準(zhǔn)備鏡像入口文件:docker-entrypoint.sh(非必需)

注意一下,此文件需要執(zhí)行權(quán)限,不過(guò)此入口文件不是必須的,只是為了在應(yīng)用運(yùn)行前執(zhí)行一些緩存命令,具體可以了解一下。

#!/usr/bin/env bash

php artisan cache:clear
php artisan config:cache
php artisan route:cache
php artisan view:cache

apache2-foreground

六、運(yùn)行鏡像

docker run -p 80:80 .

讀到這里,這篇“怎么使用Docker部署Laravel應(yīng)用”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識(shí)點(diǎn)還需要大家自己動(dòng)手實(shí)踐使用過(guò)才能領(lǐng)會(huì),如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。


本文名稱:怎么使用Docker部署Laravel應(yīng)用
網(wǎng)頁(yè)URL:http://www.dlmjj.cn/article/gcijie.html