{"id":561,"title":"\u7528dockerfile\u5236\u4f5claravel\u9879\u76ee\u955c\u50cf","good":0,"bad":0,"hit":1545,"created_at":"2023-01-14 07:38:52","content":"

dockerfile\u6587\u4ef6\u5185\u5bb9\uff1a<\/p>

<\/p>

FROM registry.cn-shanghai.aliyuncs.com\/hu-rong\/com:php7.4.15-cli-swoole4.6.3-tools<\/p>

LABEL maintainer="www.hu-rong.com" version="1.0" license="MIT" app.name="laravel-hurong"<\/p>

WORKDIR \/wwwroot\/github_www_hurong<\/p>

COPY . \/wwwroot\/github_www_hurong<\/p>

RUN cp .env.k8s .env<\/p>

RUN chmod -R 755 public<\/p>

RUN chmod -R 777 storage<\/p>

RUN unzip -o vendor.zip<\/p>

    #&& .\/composer.phar install --no-dev -o<\/p>

EXPOSE 8000<\/p>

EXPOSE 9000<\/p>

#\u5982\u679c\u7528laravel\u81ea\u5e26\u7684web\u670d\u52a1\u5c31\u5f00\u8fd9\u884c,\u8def\u5f84\u6539\u6210\u81ea\u5df1\u7684<\/p>

#ENTRYPOINT ["\/usr\/local\/bin\/php", "\/wwwroot\/github_www_hurong\/artisan", "serve", "--host=0.0.0.0", "--port=8000"]<\/span><\/p>

<\/p>

\u4fdd\u5b58\u597d\u540e\u653e\u4e8e\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\uff0c\u7136\u540e\u5728cmd\u4e2d\u6267\u884c\uff1a<\/p>

docker build -t registry.cn-shanghai.aliyuncs.com\/hu-rong\/com:laravel-hurong .<\/p>

\u955c\u50cf\u5236\u4f5c\u597d\u540e\uff0c\u53ef\u4ee5\u751f\u6210\u4e00\u4e2a\u4e34\u65f6\u5bb9\u5668\u8fdb\u53bb\u770b\u770b\u662f\u4e0d\u662f\u9884\u671f\u7684\u7ed3\u679c\uff1a<\/p>

docker run -it --rm --name test --entrypoint bash registry.cn-shanghai.aliyuncs.com\/hu-rong\/com:laravel-hurong<\/p>

\u63a8\u9001\u5230\u963f\u91cc\u4e91\uff1a<\/p>

docker push registry.cn-shanghai.aliyuncs.com\/hu-rong\/com:laravel-hurong<\/p>"}