在Dokku上创建反应应用程序部署失败

时间:2017-06-14 17:57:20

标签: reactjs heroku dokku

我正在尝试通过Create-react-app将新的React应用程序部署到DigitalOcean上的Dokku,感谢this heroku buildpacks。按照他们的指示,它最终失败了......

=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-static.git
=====> Detected Framework: Static HTML
remote:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
remote:                                  Dload  Upload   Total   Spent    Left  Speed
remote: 100  838k  100  838k    0     0   514k      0  0:00:01  0:00:01 --:--:--  514k
-----> Installed directory to /app/bin
       Using release configuration from last framework (Static HTML).
remote: cat: /tmp/build/last_pack_release.out: input file is output file
--- {}
-----> Discovering process types
       Procfile declares types ->
-----> Releasing justpushit-app (dokku/justpushit-app:latest)...
-----> Deploying justpushit-app (dokku/justpushit-app:latest)...
-----> Attempting to run scripts.dokku.predeploy from app.json (if defined)
-----> App Procfile file found (/home/dokku/justpushit-app/DOKKU_PROCFILE)
-----> DOKKU_SCALE file found (/home/dokku/justpushit-app/DOKKU_SCALE)
=====> web=1
-----> Attempting pre-flight checks
       For more efficient zero downtime deployments, create a file CHECKS.
       See http://dokku.viewdocs.io/dokku/deployment/zero-downtime-deploys/ for examples
       CHECKS file not found in container: Running simple container check...
-----> Waiting for 10 seconds ...
remote: App container failed to start!!
=====> justpushit-app web container output:
       Injecting runtime env into /app/build/static/js/main.060925d8.js (from .profile.d/inject_react_app_env.sh)
       setuidgid: usage: setuidgid account child
=====> end justpushit-app web container output
To pantouflesdokku:justpushit-app
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'dokku@pantouflesdokku:justpushit-app'

一切似乎都运转良好,但应用程序从未启动过。我在这里缺少什么?

2 个答案:

答案 0 :(得分:1)

因为我遇到了同样的问题,我为这个特定的构建包打开了一个问题:https://github.com/mars/create-react-app-buildpack/issues/54幸运的是,它的维护者非常友好地向我提供了正确的Procfile内容。

要解决此问题,您应该拥有Procfile,其中包含以下行:

web: bin/boot

而不是web: npm start这不会产生完整的开发服务器。因此,服务器的内存/ CPU使用情况应该会轻松得多。

答案 1 :(得分:0)

解决方案相当简单。整个构建工作,但必须以某种方式初始化应用程序。

我添加了Procfile并在其中写了以下内容......

web: npm start

希望它有所帮助。