aws / aws-codebuild-docker-images

Official AWS CodeBuild repository for managed Docker images http://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref.html
Other
1.11k stars 973 forks source link

Docker Images/ubuntu/standard/7.0 #668

Closed adilShaikhEGIHT closed 9 months ago

adilShaikhEGIHT commented 1 year ago

The current node version in Docker Image 7.0 is 18.16.1. A new image with new node version hasn’t been released since a month. Can I expect it to release anytime soon? like node 18.17.0. The reason I ask this is because I have some jest packages which doesn’t support the current Docker image on codebuild, but they do suppport the next version.

matheuscanela commented 1 year ago

I use cdk to deploy, so I changed my script as per below and it is now running on 18.17.1

So I added 'n 18' & 'npm i npm@latest -g' to phases, initial, command, also I am using the latest image

      synth: new ShellStep('Synth', {
        input: CodePipelineSource.connection('myapp', 'master', { connectionArn: props.config.accounts.mgnt.gitConnection }),
        commands: [
          'npm ci',
          'npm run build',
          'npx cdk synth',
        ],
        installCommands: [
          'npm i -g npm && npm ci'
        ],
      }),
      synthCodeBuildDefaults: {
        partialBuildSpec : BuildSpec.fromObject({
          phases: {
            install: {
                commands: [
                  'n 18',
                  'npm i npm@latest -g',
                ]
            }
          }
        }),
        buildEnvironment: {
          privileged: true,
          //computeType: cdk.aws_codebuild.ComputeType.LARGE, 
          buildImage: LinuxBuildImage.fromCodeBuildImageId('aws/codebuild/amazonlinux2-x86_64-standard:5.0')
        },
      },
    });
MrRatan commented 10 months ago

here is an alternate way, update your buildspec:

phases:
  install:
    runtime-versions:
      python: 3.x     #optional
    commands:
      - echo "Installing NVM and Node.js 18.17.0..."
      - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
      - . $HOME/.nvm/nvm.sh && nvm install 18.17.0
      - node -v
      - npm -v
      # ... other installation commands...
Dylan-AWS commented 9 months ago

CodeBuild released Node 20 in the AL:5.0 image and Ubuntu 7.0 and an update to node 18 (https://github.com/aws/aws-codebuild-docker-images/pull/689).