Files
weipan02_server/Dockerfile
2025-10-31 16:17:15 +08:00

39 lines
1.3 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM webdevops/php-nginx:7.2-alpine
# 设置工作目录
WORKDIR /app
# 复制项目文件
COPY . /app
# 复制 Nginx 配置文件
COPY docker/nginx/enable-php.conf /opt/docker/etc/nginx/enable-php.conf
COPY docker/nginx/vhost.conf /opt/docker/etc/nginx/vhost.conf
# 复制自定义 entrypoint 脚本
COPY docker/entrypoint.sh /usr/local/bin/custom-entrypoint.sh
# 安装时区数据并给脚本添加可执行权限
RUN apk add --no-cache tzdata && \
chmod +x /app/public/start.sh && \
chmod +x /usr/local/bin/custom-entrypoint.sh
# 设置权限app 目录可写内部文件只读runtime 目录可写
RUN chmod 755 /app && \
chmod -R 555 /app/* && \
chmod -R 755 /app/runtime
# 复制 crontab 配置并安装
COPY docker/crontab /tmp/crontab
RUN cat /tmp/crontab && \
crontab -u application /tmp/crontab && \
crontab -u application -l && \
rm /tmp/crontab
# 设置环境变量
ENV SERVER_DATE_TIMEZONE=Asia/Shanghai
ENV WEB_DOCUMENT_ROOT=/app/public \
PHP_DISPLAY_ERRORS=0 \
PHP_MEMORY_LIMIT=512M \
PHP_MAX_EXECUTION_TIME=300 \
PHP_POST_MAX_SIZE=50M \
PHP_UPLOAD_MAX_FILESIZE=50M \
PHP_DATE_TIMEZONE=${SERVER_DATE_TIMEZONE}
# 声明容器对外暴露的端口
EXPOSE 80
# 设置自定义 entrypoint
ENTRYPOINT ["/usr/local/bin/custom-entrypoint.sh"]