tnblog
首页
视频
资源
登录

前端容器启动时执行命令

3506人阅读 2022/12/24 21:24 总访问:3466990 评论:0 收藏:0 手机
分类: 容器编排

dockerfile

  1. FROM nginx
  2. RUN rm /etc/nginx/conf.d/default.conf
  3. ADD ./default.conf /etc/nginx/conf.d
  4. COPY ./certs/ /etc/nginx/cert/
  5. COPY ./dist/ /usr/share/nginx/html/
  6. COPY ./container-start.sh /00-container-start.sh
  7. RUN chmod +x 00-container-start.sh
  8. RUN cp /00-container-start.sh /docker-entrypoint.d/


container-start.sh

  1. #!/bin/bash
  2. echo $BACK_API_URL
  3. echo $BACK_IDENTITY_URL
  4. # export BACK_API_URL="https://bob:5000"
  5. # export BACK_IDENTITY_URL="https://bob:7200"
  6. for f in `ls /usr/share/nginx/html/js/ | grep app`
  7. do
  8. echo $f
  9. filepath=/usr/share/nginx/html/js/$f
  10. filemappath=/usr/share/nginx/html/js/$f
  11. sed -i 's#'https://localhost:5000'#'$BACK_API_URL'#g' $filepath
  12. sed -i 's#'https://localhost:7200'#'$BACK_IDENTITY_URL'#g' $filemappath
  13. done
  14. echo "finish!!!"

欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739

评价
这一世以无限游戏为使命!
排名
2
文章
634
粉丝
44
评论
93
docker中Sware集群与service
尘叶心繁 : 想学呀!我教你呀
一个bug让程序员走上法庭 索赔金额达400亿日元
叼着奶瓶逛酒吧 : 所以说做程序员也要懂点法律知识
.net core 塑形资源
剑轩 : 收藏收藏
映射AutoMapper
剑轩 : 好是好,这个对效率影响大不大哇,效率高不高
ASP.NET Core 服务注册生命周期
剑轩 : http://www.tnblog.net/aojiancc2/article/details/167
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术