欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Docker部署Laravel應(yīng)用的實(shí)現(xiàn)示例

 更新時(shí)間:2019年09月02日 11:47:48   作者:Where  
這篇文章主要介紹了Docker部署Laravel應(yīng)用的實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
  • 本文 PHP 基礎(chǔ)鏡像使用:php:7.3-apache
  • 本文 Laravel 版本為:laravel:5.8.*
  • 隊(duì)列和任務(wù)調(diào)度我們?cè)?a target="_blank" href="http://www.dbjr.com.cn/article/169074.htm">下一篇寫(xiě)

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

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

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

<VirtualHost *:80>
 # 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
</VirtualHost>

三、 準(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í)行一些緩存命令,具體可以點(diǎn)這里去文檔了解一下。

#!/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 .

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Docker中的四種網(wǎng)絡(luò)模式

    Docker中的四種網(wǎng)絡(luò)模式

    Docker網(wǎng)橋是宿主機(jī)虛擬出來(lái)的,并不是真實(shí)存在的網(wǎng)絡(luò)設(shè)備,外部網(wǎng)絡(luò)是無(wú)法尋址到的,這也意味著外部網(wǎng)絡(luò)無(wú)法通過(guò)直接Container-IP訪問(wèn)到容器。本文詳細(xì)介紹了docker中的四種網(wǎng)絡(luò)模式,感興趣的小伙伴可以參考一下
    2023-04-04
  • Docker 命令自動(dòng)補(bǔ)全的實(shí)現(xiàn)

    Docker 命令自動(dòng)補(bǔ)全的實(shí)現(xiàn)

    這篇文章主要介紹了Docker 命令自動(dòng)補(bǔ)全的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-12-12
  • centos6使用docker部署redis主從數(shù)據(jù)庫(kù)操作示例

    centos6使用docker部署redis主從數(shù)據(jù)庫(kù)操作示例

    這篇文章主要介紹了centos6使用docker部署redis主從數(shù)據(jù)庫(kù)操作,結(jié)合實(shí)例形式分析了centos6環(huán)境下docker部署redis主從數(shù)據(jù)庫(kù)相關(guān)命令與使用技巧,需要的朋友可以參考下
    2020-02-02
  • docker 連接宿主Mysql操作

    docker 連接宿主Mysql操作

    這篇文章主要介紹了docker 連接宿主Mysql操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-11-11
  • Docker項(xiàng)目部署之從后端到前端部署詳細(xì)流程

    Docker項(xiàng)目部署之從后端到前端部署詳細(xì)流程

    在當(dāng)今的軟件開(kāi)發(fā)領(lǐng)域,容器化技術(shù)已經(jīng)成為了部署和管理應(yīng)用程序的重要手段,下面這篇文章主要給大家介紹了關(guān)于Docker項(xiàng)目部署之從后端到前端部署的相關(guān)資料,需要的朋友可以參考下
    2024-08-08
  • docker刪除鏡像的實(shí)現(xiàn)方式詳解

    docker刪除鏡像的實(shí)現(xiàn)方式詳解

    這篇文章主要為大家介紹了docker刪除鏡像的實(shí)現(xiàn)方式詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-07-07
  • Docker中Nginx反向代理的實(shí)現(xiàn)步驟

    Docker中Nginx反向代理的實(shí)現(xiàn)步驟

    為了安全考慮,我們一般會(huì)設(shè)置反向代理,用來(lái)屏蔽應(yīng)用程序真實(shí)的IP和端口號(hào),本文主要介紹了Docker中Nginx反向代理的實(shí)現(xiàn)步驟,具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-03-03
  • 如何使用docker極簡(jiǎn)打包java.jar鏡像并啟動(dòng)

    如何使用docker極簡(jiǎn)打包java.jar鏡像并啟動(dòng)

    這篇文章主要介紹了如何使用docker極簡(jiǎn)打包java.jar鏡像并啟動(dòng),本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-08-08
  • docker將鏡像打包為.tar包實(shí)現(xiàn)方法

    docker將鏡像打包為.tar包實(shí)現(xiàn)方法

    使用tar包格式進(jìn)行壓縮,方便在不同的docker主機(jī)之間進(jìn)行遷移和備份,下面這篇文章主要給大家介紹了關(guān)于docker將鏡像打包為.tar包的實(shí)現(xiàn)方法,需要的朋友可以參考下
    2024-07-07
  • 三分鐘完成 ubuntu16.04初始化,Java,maven,docker環(huán)境的部署問(wèn)題

    三分鐘完成 ubuntu16.04初始化,Java,maven,docker環(huán)境的部署問(wèn)題

    這篇文章主要介紹了三分鐘完成 ubuntu16.04初始化,Java,maven,docker環(huán)境的部署問(wèn)題,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧
    2020-11-11

最新評(píng)論