使用Docker Compose的Netlify Jekyll部署失败

时间:2018-10-14 09:25:03

标签: docker docker-compose jekyll netlify

我正在使用docker-compose构建我的Jekyll项目:

[projectname]/
├── mysite/
│   ├── .gitignore
│   ├── Gemfile
│   ├── vendor
│   └── [...]
├── docker-compose.yml
└── vendor

文件夹结构如下

11:08:51 AM: Preparing Git Reference refs/heads/master
11:08:52 AM: Starting build script
11:08:52 AM: Installing dependencies
11:08:54 AM: Downloading and installing node v8.12.0...
11:08:54 AM: Downloading https://nodejs.org/dist/v8.12.0/node-v8.12.0-linux-x64.tar.xz...
11:08:54 AM: 
#
11:08:54 AM:                                              1.9%
11:08:54 AM: 
#########################
11:08:54 AM:                           35.1%
11:08:54 AM: 
######################################
11:08:54 AM: ################                    76.1%
11:08:54 AM: 
##################################################
11:08:54 AM: ###################### 100.0%
11:08:54 AM: Computing checksum with sha256sum
11:08:54 AM: Checksums matched!
11:08:56 AM: Now using node v8.12.0 (npm v6.4.1)
11:08:56 AM: Attempting ruby version 2.3.6, read from environment
11:08:57 AM: Using ruby version 2.3.6
11:08:57 AM: Using PHP version 5.6
11:08:57 AM: Started restoring cached go cache
11:08:57 AM: Finished restoring cached go cache
11:08:57 AM: unset GOOS;
11:08:57 AM: unset GOARCH;
11:08:57 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
11:08:57 AM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
11:08:57 AM: go version >&2;
11:08:57 AM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env';
11:08:57 AM: go version go1.10 linux/amd64
11:08:57 AM: Installing missing commands
11:08:57 AM: Verify run directory
11:08:57 AM: Executing user command: jekyll build
11:08:57 AM: /usr/local/bin/build: line 32: jekyll: command not found
11:08:57 AM: Caching artifacts
11:08:58 AM: Started saving pip cache
11:08:58 AM: Finished saving pip cache
11:08:58 AM: Started saving emacs cask dependencies
11:08:58 AM: Finished saving emacs cask dependencies
11:08:58 AM: Started saving maven dependencies
11:08:58 AM: Finished saving maven dependencies
11:08:58 AM: Started saving boot dependencies
11:08:58 AM: Finished saving boot dependencies
11:08:58 AM: Started saving go dependencies
11:08:58 AM: Finished saving go dependencies
11:08:58 AM: Cached node version v8.12.0
11:08:58 AM: Error running command: Build script returned non-zero exit code: 127
11:08:58 AM: Failing build: Failed to build site
11:08:58 AM: failed during stage 'building site': Build script returned non-zero exit code: 127
11:08:58 AM: Finished processing build request in 7.670431208s

我现在正尝试部署到Netlify,但是文件夹结构似乎带来了问题,因为它们全部在mysite下,而不在上面的文件夹中。但是,通过使用docker-compose,我不知道如何更改它。我在Netlify上部署时遇到的错误是在这里:

<script type = "text/javascript">
        var sentence = prompt("Enter a sentence");
        var words = array(words here);
        document.write(array[0][0]);
        document.write(array[1][0]);
        // and so on..
</script>

1 个答案:

答案 0 :(得分:0)

Netlify允许使用base设置项目的netlify.toml目录位置

netlify.toml(需要在存储库的根目录中)

[build]
  # Directory to change to before starting a build. 
  # This is where we will look for package.json/.nvmrc/etc.
  base = "project/"
  # Directory (relative to root of your repo) that contains the deploy-ready 
  # HTML files and assets generated by the build.
  publish = "project/build-output/"

了解其他选项in the docs

另一种选择是将mysite文件夹移动到它自己的存储库中,因为Netlify不需要docker配置来设置运行jekyll的环境,因为默认情况下它支持它。