Gitpod workspace configuration¶
Gitpod workspace configuration allows developers to define and automate the setup of their cloud development environments.^[400-devops-04-ci-cd-pipelines-github-gitpod.md] By committing specific files to a repository, users can specify the development tools, runtimes, and dependencies required for their project, ensuring the workspace is "always ready to code" upon launch.^[400-devops-04-ci-cd-pipelines-github-gitpod.md]
Core Configuration Files¶
The behavior of a Gitpod workspace is primarily controlled by two files that can be added to the project's root directory:
.[Gitpod](<./gitpod.md>).yml: This is the main configuration file where tasks, environment variables, and other workspace settings are defined.^[400-devops-04-ci-cd-pipelines-github-gitpod.md].[Gitpod](<./gitpod.md>).Dockerfile: This file is optional and is used to define a custom Docker image for the workspace if the standard images do not suffice.^[400-devops-04-ci-cd-pipelines-github-gitpod.md]
Customizing the Docker Image¶
While Gitpod provides default images that come pre-installed with many common tools (such as Maven, Gradle, and Java), specific environments can be configured using a Dockerfile.^[400-devops-04-ci-cd-pipelines-github-gitpod.md] To use a custom image, the .[Gitpod](<./gitpod.md>).yml file must reference the Dockerfile using the image.file directive.^[400-devops-04-ci-cd-pipelines-github-gitpod.md]
For example, to create an environment with a specific version of Java, the configuration might look like this:
# .[Gitpod](<./gitpod.md>).yml
image:
file: .[Gitpod](<./gitpod.md>).Dockerfile
# .[Gitpod](<./gitpod.md>).Dockerfile
FROM [Gitpod](<./gitpod.md>)/workspace-full
USER [Gitpod](<./gitpod.md>)
RUN bash -c ". /home/[Gitpod](<./gitpod.md>)/.[SDKMAN](<./sdkman.md>)/bin/sdkman-init.sh && \
sdk install java 17.0.3-ms && \
sdk default java 17.0.3-ms"
^[400-devops-04-ci-cd-pipelines-github-gitpod.md]
Workspace Workflow¶
Configuration is an iterative process that can be performed directly within the Gitpod environment.^[400-devops-04-ci-cd-pipelines-github-gitpod.md] The recommended workflow is:
- Launch a workspace: Start by navigating to the repository URL (e.g., on GitHub) prefixed with
gitpod.io/#.^[400-devops-04-ci-cd-pipelines-github-gitpod.md] - Create configuration: Create the
.[Gitpod](<./gitpod.md>).ymland optional.[Gitpod](<./gitpod.md>).Dockerfiledirectly in the running workspace.^[400-devops-04-ci-cd-pipelines-github-gitpod.md] - Commit and test: Commit these files to the repository. Subsequent workspace launches will automatically apply these configurations.^[400-devops-04-ci-cd-pipelines-github-gitpod.md]
Related Concepts¶
- DevOps
- CI/CD Pipelines
- [[Docker]]
- [[Cloud IDE]]
Sources¶
400-devops-04-ci-cd-pipelines-github-gitpod.md