神剑山庄资源网 Design By www.hcban.com
- 本文 PHP 基础镜像使用:php:7.3-apache
- 本文 Laravel 版本为:laravel:5.8.*
- 队列和任务调度我们在下一篇写
一、 准备我们的 Laravel 应用
# 运行 mix 命令,打包 js、css、img 文件,如果没有用到 mix 这一步可以省略 npm install npm run production # 安装 composer.lock 中的依赖 composer install --ignore-platform-reqs --optimize-autoloader --no-dev
二、 准备 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>
三、 准备 Dockerfile 文件
FROM php:7.3-apache LABEL maintainer="liuzhaowei55@gmail.com" # 设置时区 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 # 访问端口 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
四、准备 Dockerignore 文件:.dockerignore(非必需)
/node_modules /.dockerignore /Dockerfile
五、准备镜像入口文件:docker-entrypoint.sh(非必需)
注意一下,此文件需要执行权限,不过此入口文件不是必须的,只是为了在应用运行前执行一些缓存命令,具体可以点这里去文档了解一下。
#!/usr/bin/env bash php artisan cache:clear php artisan config:cache php artisan route:cache php artisan view:cache apache2-foreground
六、运行镜像
docker run -p 80:80 .
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
神剑山庄资源网 Design By www.hcban.com
神剑山庄资源网
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
神剑山庄资源网 Design By www.hcban.com
暂无Docker部署Laravel应用的实现示例的评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年09月21日
2024年09月21日
- 王菲.1999-只爱陌生人【EMI百代】【WAV+CUE】
- 林美音.1993-酒后的心声【瑞华】【WAV+CUE】
- 群星.2024-凡人歌电视剧原声带【正午阳光】【FLAC分轨】
- 黑神话悟空上品骨悚然精魄获取方法一览|上品骨悚然精魄收集攻略
- 《演灭Evotinction》正式登陆多平台发售!带你进入科幻潜行新境界
- 命运圣契2024公测最新兑换码大全 命运圣契开服可用兑换码汇总
- 银霞.1979-《回答·兰花草》新加坡限量复黑版[WAV+CUE]
- 王菲.1996-《乐乐精逊SACD日本限量版[WAV+CUE]
- 王菲.1996-《乐乐精逊SACD日本限量版[WAV+CUE]
- 不止黑神话!杭州给原创企业真金白银扶持 打造“杭州游戏”品牌
- 很有多样性:《战锤》首次引入非二元性别角色
- 《少女前线2:追放》项目组将裁员 官方:进一步优化组织结构
- 陈慧琳.2002-闪亮每一天新歌+精选2CD【正东】【WAV+CUE】
- 袁培华.1992-有缘【歌林】【WAV+CUE】
- 王瑞霞.1996-是我太软心【名冠】【WAV+CUE】