[英]Need to deploy Node.js docker image to AWS Elastic Beanstalk using bitbucket-pipeline
[英]BitBucket Pipeline - Build and deploy using node / gulp / git ftp
昨天我注意到BitBucket支持CICD管道,这是我渴望使用的一个了不起的功能。
但是我设置起来有些困难。
我的建设过程一般:
gulp命令正在构建HTML应用程序并将输出放置到build
文件夹。 构建完成后,我希望将代码转移到我网站上的目录中。
这转换为以下bitbucket.yml
:
# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:6.9.4
pipelines:
default:
- step:
caches:
- node
script: # Modify the commands below to build your repository.
- npm install
- npm install -g bower
- bower install --allow-root
- npm install -g gulp
- gulp
- cd build
- apt-get update
- apt-get -qq install git-ftp
- git ftp init --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://mywebsite.com/public_html/mydirectory
我得到的问题是git ftp init
似乎是上传src
文件夹,而不是在gulp
步骤中创建的build
内容。
有任何想法吗?
更新:-- --syncroot
似乎是一个部分修复。 这意味着它现在尝试上传build
目录。 但是,此时的问题是git ftp
似乎只是同步跟踪文件。
因为build
文件夹中的文件是在管道构建期间创建的,所以不适用于这些文件。
我试图添加一个名为.git-ftp-include
的文件, .git-ftp-include
应该传输未跟踪的文件。 遗憾的是,我没有成功部署我的代码。
.git-ftp-include
文件内容:build / index.html:/src/index.html
基本上说:每当src
目录中的index.html
发生更改时,都会从build
同步根中上传index.html
。
对于要通过git-ftp
传输的未跟踪文件, .git-ftp-include
的语法是!filename 。
在这种情况下,我建议您使用ncftp
。 在管道中将是这样的:
- apt-get -qq install ncftp
- ncftpput -v -u "$FTP_USERNAME" -p "$FTP_PASSWORD" -R $FTP_HOST /remote build/*
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.