hyperf/docker/Dockerfile

30 lines
1.2 KiB
Docker
Executable File
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

FROM registry.cn-shanghai.aliyuncs.com/gong92-socl/debian-nginx-php114-74
#FROM gong921123/debian-nginx-php114-74:latest
# 复制当前目录的所有 到上面容器的 var/www中去变成一个新的镜像
# 要想复制其他文件 就必须把dockerfile和其他文件放一起
# 这里复制了这个项目的所有
RUN ls -a
#COPY . /var/www
RUN apt-get update && apt-get install -y pv
# 带进度显示的复制操作
RUN tar -cf - . | pv -s $(du -sb . | cut -f1) | tar -xf - -C /var/www
# 验证复制结果
RUN echo "====== 复制完成,目录内容如下 ======" && \
ls -alh /var/www && \
echo "====== 文件数量统计 ======" && \
find /var/www -type f | wc -l
# CMD不同于RUNCMD用于指定在容器启动时所要执行的命令而RUN用于指定镜像构建时所要执行的命令
# CMD只运行出现一次 多次出现只会执行最后一个
# 启动 hyperf 框架 并且 启动Nginx 服务器
#CMD ["php", "bin/hyperf.php", "start"]
#CMD ["nginx"]
#CMD php bin/hyperf.php start && nginx -g 'daemon off;'
#CMD php bin/hyperf.php start && nginx
# nginx -g 'daemon off;' 它将以前台模式运行,并将日志输出到终端