部署 Heroku 安装 libssl1.0-dev

runup · November 06, 2018 · Last by jasl replied at November 09, 2018 · 6796 hits

将系统部署在 heroku 上之后,发现少了一库 libssl1.0-dev,试着在 heroku 中进行安装,最终未果,下面是试过的几种方法

#heroku run shell
#apt install libssl1.0-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
W: Not using locking for read only lock file /var/lib/dpkg/lock-frontend
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to locate package libssl1.0-dev
E: Couldn't find any package by glob 'libssl1.0-dev'
E: Couldn't find any package by regex 'libssl1.0-dev'

#sudo apt install libssl1.0-dev
#显示没有sudo这个命令,就是heroku中不能执行sudo

#apt update 
List directory /var/lib/apt/lists/partial is missing  #新建这个文件夹也不行

你没有理解 heroku 的运作原理,heroku 应用运行在叫做 dynos 的容器里面,不同于一般的 Linux server,为了安全肯定做了一些限制。就算用 heroku run shell 成功安装了某个包,因为它是单独开启的容器,里面的修改也不能用于其它服务进程。

如果你需要修改 heroku 容器,需要了解它的 Builde pack 机制

不过还有更好的选择,就是通过 docker 镜像部署

Heroku 涉及 C 扩展可以参考下 sassc-rails 提供的方案 https://github.com/sass/sassc-rails#deployment-to-heroku

You need to Sign in before reply, if you don't have an account, please Sign up first.