简体   繁体   English

如何使用新的 buildpacks.io 框架部署 heroku nginx buildpack?

[英]How to deploy the heroku nginx buildpack using the new buildpacks.io framework?

I am following this tutorial to deploy a custom heroku buildpack for nginx:我正在按照本教程为 nginx 部署自定义 heroku buildpack:

http://jkutner.github.io/2020/05/26/cloud-native-buildpacks-shim.html http://jkutner.github.io/2020/05/26/cloud-native-buildpacks-shim.html

When I deploy the original heroku nginx buildpack: https://github.com/heroku/heroku-buildpack-nginx当我部署原来的heroku nginx buildpack时: https : //github.com/heroku/heroku-buildpack-nginx

After using pack to compile and build it, the following error is thrown:使用pack编译构建后,抛出如下错误:

cp: 'bin/start-nginx' and '/workspace/bin/start-nginx' are the same file

This is how the compile script looks like:这是编译脚本的样子:

#!/usr/bin/env bash

set -e

# clean up leaking environment
unset GIT_DIR

# parse and derive params
BUILD_DIR=my_nginx
CACHE_DIR=$2
BUILDPACK_DIR="$(dirname "$(dirname "$0")")"

mkdir -p "$BUILD_DIR/bin/"
mkdir -p "$BUILD_DIR/nginx"
tar -zxvf "nginx-$STACK".tgz -C "$BUILD_DIR/nginx"

cp "$BUILD_DIR/nginx/nginx" "$BUILD_DIR/bin/nginx"
cp "$BUILD_DIR/nginx/nginx-debug" "$BUILD_DIR/bin/nginx-debug"

nginx_version=$($BUILD_DIR/bin/nginx -V 2>&1 | head -1 | awk '{ print $NF }')
echo "-----> nginx-buildpack: Installed ${nginx_version} to app/bin"
cp bin/start-nginx "$BUILD_DIR/bin/"
echo '-----> nginx-buildpack: Added start-nginx to app/bin'
cp bin/start-nginx-debug "$BUILD_DIR/bin/"
echo '-----> nginx-buildpack: Added start-nginx-debug to app/bin'
cp bin/start-nginx-solo "$BUILD_DIR/bin/"
echo '-----> nginx-buildpack: Added start-nginx-solo to app/bin'

mkdir -p "$BUILD_DIR/config"

if [[ ! -f $BUILD_DIR/config/mime.types ]]; then
        cp "$BUILD_DIR/nginx/mime.types" "$BUILD_DIR/config/"
        echo '-----> nginx-buildpack: Default mime.types copied to app/config/'
else
        echo '-----> nginx-buildpack: Custom mime.types found in app/config.'
fi

if [[ ! -f $BUILD_DIR/config/nginx.conf.erb ]]; then
        cp config/nginx.conf.erb "$BUILD_DIR/config/"
        echo '-----> nginx-buildpack: Default config copied to app/config.'
else
        echo '-----> nginx-buildpack: Custom config found in app/config.'
fi

# cleanup
rm -r "$BUILD_DIR/nginx"

exit 0

Is this buildpack broken , where can I find a proper nginx buildpack to use since the heroku one causes these issues?这个 buildpack 坏了,我在哪里可以找到合适的 nginx buildpack 来使用,因为 heroku 会导致这些问题?

You can refer to the article given below and take help from it.您可以参考下面给出的文章并从中获得帮助。 Also, I am providing the link to the Heroku-Nginx pack which is the most preferable one.另外,我提供了 Heroku-Nginx 包的链接,这是最可取的。

Article : https://koed00.github.io/Heroku_setups/文章: https : //koed00.github.io/Heroku_setups/

Pack: https://github.com/heroku/heroku-buildpack-nginx打包: https : //github.com/heroku/heroku-buildpack-nginx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM