Mở bảng điều khiển Gitlab của bạn.
fcj-book-store-frontend
tại Project name.Cấu hình khóa SSH để giao tiếp với Gitlab.
Tải mã nguồn lên dự án fcj-book-store-frontend trên Gitlab.
Đi đến thư mục gốc của dự án FCJ-Serverless-Workshop mà bạn đã tải xuống trước đó.
Mở src/config.js, thay đổi giá trị của APP_API_URL thành giá trị của ApiUrl mà bạn đã ghi lại trong bước Tạo pipeline SAM, trong trường hợp này là https://zr0i1ihy24.execute-api.us-east-1.amazonaws.com/staging
.
Tiếp theo, tạo một tệp mới có tên buildspec.yml
tại thư mục gốc của dự án FCJ-Serverless-Workshop như mã sau.
version: 0.2
phases:
install:
runtime-versions:
nodejs: 20.9.0
commands:
- npm install -g yarn
pre_build:
commands:
- echo Removing lock files...
- rm -f package-lock.json
- rm -f yarn.lock
build:
commands:
- echo Build started on `date`
- yarn install
- yarn build
artifacts:
base-directory: build
files:
- "**/*"
discard-paths: no
Chạy mã dưới đây trong terminal của bạn tại thư mục gốc của dự án FCJ-Serverless-Workshop.
rm -rf .git
git init
git remote add origin git@gitlab.com:fcj-ws/fcj-book-store-frontend.git
git add .
git commit -m "Init project"
git push --set-upstream origin master
Quay lại dự án fcj-book-store-frontend trên Gitlab. Bạn có thể thấy mã đã được tải lên.