Heads up! On October 1, we introduced Gitpod Flex. You can swap between documentation by using the switcher in the left navigation bar.

Configure development environment

With Gitpod, you have a fully configured development environment that starts in a single-click. We achieve this through configuring a Dev Container and Automations. This guide takes you through configuring your first environment.

Pre-requisites
Install Gitpod Desktop or the AWS Runner before completing this guide.

Steps

Create an environment

Start by choosing a repository and environment class to launch your first environment. Once launched we’ll then configure the environment and save it as a project. This will mean that you’ve created a blueprint so your team can also self-serve a one-click experience for their own fully prepared development environment.

Configure your Dev Container

Let’s get started with Dev Container to eliminate the need to manually install tools and dependencies. If you don’t have an existing devcontainer in your repository Gitpod will create a basic example file for you in your environment.

A basic Dev Container example stored in .devcontainer/devcontainer.json

language icon json
{
	"name": "Node.js Dev Container",
	"image": "mcr.microsoft.com/devcontainers/javascript-node:0-18",
	"customizations": {
		"vscode": {
			"settings": {},
			"extensions": ["dbaeumer.vscode-eslint"]
		}
	},
	"updateContentCommand": "npm install",
	"remoteUser": "node"
}

As you make changes you can rebuild your environment by running:

gitpod environment devcontainer rebuild.

See devcontainer for more.

Configuring Automations

Automations go beyond Dev Container and are a powerful way to define, automate and share common workflows that you perform with your development environment

Automations are defined in configuration YAML files and updated via the Gitpod CLI that comes preinstalled in your environment.

For example:

  • Seeding a database
  • Running a unit test.

See automations - examples for many more automation examples.

An example Automations file example stored in .gitpod/automations.yaml

language icon yml
services:
    database:
        name: PostgreSQL
        commands:
            start: docker run postgres
tasks:
    run-unit-tests:
        name: Runs unit tests
        command: go test -v ./...

When you’re done run gitpod automations update to register your Automations with Gitpod.

See automations for more.

Publishing your project

When done commit both your devcontainer and automation configuration files and hit publish on your project in Gitpod. You’ve now set up a fully-configured project that is your blueprint for a fully-configured development environment and it’s now shared with your team inside your Gitpod organization.

What next?

Now that you’re done, why not take a look at:

Was this helpful?