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

Using workspace-base to create a custom gitpod env image #2576

Merged
merged 1 commit into from Dec 8, 2021

Conversation

dhillonks
Copy link
Contributor

Issue This PR Addresses

Closes #2564

Type of Change

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

As highlighted in #2564, a smaller, more optimized image for gitpod can be created rather than using the default workspace-full which contains a lot of tools that we are not using. So, I've added a custom .gitpod.Dockerfile using the gitpod/workspace-base image.

Changes

Installed the following on top of the base image:

Verified the installation by building and running the image locally:
image

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: N/A
  • Documentation: N/A

@gitpod-io
Copy link

gitpod-io bot commented Dec 7, 2021

@dhillonks
Copy link
Contributor Author

Able to run the project in the new custom workspace:
image

Verifying that the workspace only has the tools installed through the custom .gitpod.Dockerfile (rather than the default full image):
image

@humphd Could you please take a look?

@dhillonks dhillonks requested a review from humphd December 7, 2021 05:26
@dhillonks dhillonks marked this pull request as ready for review December 7, 2021 05:27
USER gitpod
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
RUN sudo apt-get install -y nodejs
RUN sudo npm install -g typescript yarn pnpm
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we need typescript and yarn. The front-end installs typescript as one of its dependencies, and I think yarn has never been part of telescope (but I'd be happy if we started using it).

Copy link
Contributor Author

@dhillonks dhillonks Dec 7, 2021

Choose a reason for hiding this comment

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

I added yarn, as the readme.md in telescope/src/web/ mentions the use of yarn dev to run the development server. I'm not sure if we need typescript but I added these two while I was going through telescope after adding Node, Docker and pnpm, so I could definitely remove them if needed. Please let me know if they are not required for the environment.

.gitpod.Dockerfile Outdated Show resolved Hide resolved
@dhillonks
Copy link
Contributor Author

dhillonks commented Dec 8, 2021

Installing Node through nvm now, rather than NodeSource:
image

.gitpod.Dockerfile Outdated Show resolved Hide resolved
&& bash -c ". .nvm/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& npm install -g typescript yarn pnpm"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why yarn?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, why install TS globally? I think we install it as part of the web front-end, so this shouldn't be needed. Only pnpm is needed globally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just going off of yarn dev here: src/web/readme.md

Is it not needed?

&& bash -c ". .nvm/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& npm install -g typescript yarn pnpm"
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, why install TS globally? I think we install it as part of the web front-end, so this shouldn't be needed. Only pnpm is needed globally.

.gitpod.Dockerfile Outdated Show resolved Hide resolved
* Adding custom dockerfile to gitpod yml

* Installing node through nvm instead of nodesource

* Using LTS node from nvm and removing typescript

* Removing yarn
@dhillonks
Copy link
Contributor Author

Using Node LTS through nvm now and removed yarn, typescript:
image

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

I know very little about gitpod, so I can't comment on this deeply. But what I see looks good.

Copy link
Contributor

@DukeManh DukeManh left a comment

Choose a reason for hiding this comment

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

LGTM. This saves us some time opening up a new workspace.

@humphd humphd merged commit a3f1a3e into Seneca-CDOT:master Dec 8, 2021
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.

Optimize Gitpod Environment Image
4 participants