Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dockerfile): add yarn #4844

Merged
merged 4 commits into from
Nov 8, 2019
Merged

Conversation

arnulfojr
Copy link
Contributor

Install the latest yarn version in the docker image.
Fixes #4843

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@mergify
Copy link
Contributor

mergify bot commented Nov 4, 2019

Thanks so much for taking the time to contribute to the AWS CDK ❤️

We will shortly assign someone to review this pull request and help get it
merged. In the meantime, please take a minute to make sure you follow this
checklist
:

  • PR title type(scope): text
    • type: fix, feat, refactor go into CHANGELOG, chore is hidden
    • scope: name of module without aws- or cdk- prefix or postfix (e.g. s3 instead of aws-s3-deployment)
    • text: use all lower-case, do not end with a period, do not include issue refs
  • PR Description
    • Rationale: describe rationale of change and approach taken
    • Issues: indicate issues fixed via: fixes #xxx or closes #xxx
    • Breaking?: last paragraph: BREAKING CHANGE: <describe what changed + link for details>
  • Testing
    • Unit test added. Prefer to add a new test rather than modify existing tests
    • CLI or init templates change? Re-run/add CLI integration tests
  • Documentation
    • README: update module README to describe new features
    • API docs: public APIs must be documented. Copy from official AWS docs when possible
    • Design: for significant features, follow design process

Dockerfile Outdated
@@ -22,7 +22,10 @@ RUN yum -y --security update \
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt \
&& curl -fsSLO "https://yarnpkg.com/latest.tar.gz" \
Copy link
Contributor

@nmussy nmussy Nov 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should add a hash verification, like is done for node above. See docker-node Dockerfile as an example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lastest version is ok or shall I fix the yarn version @nmussy ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the version to 1.19.1 let me know if you'd like to change it otherwise :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested your Dockerfile, but it seems you're missing the ln commands required to add yarn to the path (see example).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it depends on how you want to save the yarn binary but atm the yarn is actually exported in the path becuase is extracted directly into /usr/local
In the current PR I used the same extraction command than the one used for node,

tar zvxf yarn-v$YARN_VERSION.tar.gz -C /usr/local --strip-components=1 --no-same-owner

That means that the first component from yarn-v<numbers> will be used to save the file -> yarn.
There's also the possibility of using the symlink while preserving the version number ->

&& tar zvxf yarn-v$YARN_VERSION.tar.gz -C /opt/ --no-same-owner \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn

I chose the first one just to be consistent with the node extraction but if you think the latter is better (more clear) then we can go for it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I missed the --strip-components=1. 😄

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@arnulfojr arnulfojr changed the title Install yarn in docker image fix(Dockerfile): Install yarn in docker image Nov 4, 2019
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@arnulfojr arnulfojr force-pushed the fix/add-yarn-to-docker-image branch from 2a19472 to d8b0f5a Compare November 7, 2019 14:13
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@eladb eladb changed the title fix(Dockerfile): Install yarn in docker image fix(dockerfile): add yarn Nov 8, 2019
@mergify
Copy link
Contributor

mergify bot commented Nov 8, 2019

Thank you for contributing! Your pull request is now being automatically merged.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 2f8d06a into aws:master Nov 8, 2019
@arnulfojr arnulfojr deleted the fix/add-yarn-to-docker-image branch November 8, 2019 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Yarn is missing from the Dockerfile
4 participants