Open2

AWS CodeBuild の buildpsec.yml サンプル

konbu33konbu33
buildspec.yml
version: 0.2

phases:
  pre_build:
    commands:
      - echo start pre build...

      # node, npm
      - curl https://get.volta.sh | bash
      - export VOLTA_HOME=$HOME/.volta
      - export PATH=$PATH:$VOLTA_HOME/bin
      - volta --version
      - volta install node@18
      - node -v; npm -v 
      
      # aws cli
      - apt update -y
      - apt install -y zip
      - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
      - unzip awscliv2.zip
      - sudo ./aws/install
      - aws --version

      # git
      - apt install -y git
      - git --version
      - git clone <git url>
      - cd laravel-sample
      
  build:
    commands: 
      - echo start build...

      # build
      - npm ci
      - npm run build

  post_build:
    commands:
      - echo start post build...

artifacts:
  file: 
    - '**/*' 
  base-directory: public
konbu33konbu33
docker-compose.yml
version: '3.6'
services:
  phpweb:
    image: php:8.2-fpm
    platform: linux/x86_64
    command:
#      - sh -c "echo helloworld"