![](/img/trans.png)
[英]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.