how do I structure my buildspec file in CodeDeploy to copy a single file

Viewed 11

I've built a website in Capacitor and am trying to copy a zipped version of the dist folder across to an S3 bucket after each commit to the main branch. I'm using CodePipeline to create a 3 step process - Source, Build, Deploy. I'm using CodeBuild for the Build phase. This is my buildspec file -

version: 0.2
phases:
   install:
     runtime-versions:
         php: 8.1
         nodejs: 16.x
   pre_build:
     commands:
         - npm install
         - node_modules/vite/bin/vite.js build
   build:
     commands:
         - zip -r release-1.2.6.zip dist/*
         - ls
artifacts:
  files: 
      - './release-1.2.6.zip'
  name: release-1.2.6.zip
  discard-paths: yes

The build runs fine, and creates the zip file but instead of being written to the S3 bucket as

https://mybucketname.s3.eu-west-1.amazonaws.com/release-1.2.6.zip

it appears as two slashes

https://mybucketname.s3.eu-west-1.amazonaws.com//

I'm clearly doing something stupid but for the life of me I can't figure out what. Any pointers would be greatly appreciated.

0 Answers
Related