From b78b725ee7ce9104c19f7756a9babbcc0af6003f Mon Sep 17 00:00:00 2001 From: Jonathan Nagayoshi Date: Tue, 29 Nov 2022 03:04:28 +0000 Subject: [PATCH 1/2] feat: implemented devcontainers support for developing in the backstage repository locally Signed-off-by: Jonathan Nagayoshi --- .devcontainer/Dockerfile | 5 +++++ .devcontainer/devcontainer.json | 30 ++++++++++++++++++++++++++++++ .devcontainer/postCreate.sh | 3 +++ README.md | 1 + 4 files changed, 39 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/postCreate.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..35459b8d97 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,5 @@ +FROM mcr.microsoft.com/devcontainers/typescript-node:18 + +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install chromium \ + && apt-get -y install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..075e0c2ec9 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,30 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node +{ + "name": "Base Backstage Workspace", + "build": { "dockerfile": "Dockerfile" }, + "features": { + "ghcr.io/devcontainers/features/common-utils:1": {}, + "ghcr.io/devcontainers/features/docker-from-docker:1": {}, + "ghcr.io/devcontainers-contrib/features/mkdocs:1": {} + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 7007], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "bash .devcontainer/postCreate.sh", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": ["Intility.vscode-backstage"] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.devcontainer/postCreate.sh b/.devcontainer/postCreate.sh new file mode 100755 index 0000000000..f0631a4af2 --- /dev/null +++ b/.devcontainer/postCreate.sh @@ -0,0 +1,3 @@ +#!/bin/bash +yarn install +pip install mkdocs-techdocs-core \ No newline at end of file diff --git a/README.md b/README.md index 8a2bd338d9..115f1ed6d6 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ ![Code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) [![Codecov](https://img.shields.io/codecov/c/github/backstage/backstage)](https://codecov.io/gh/backstage/backstage) [![](https://img.shields.io/github/v/release/backstage/backstage)](https://github.com/backstage/backstage/releases) +[![VS Code Container](https://img.shields.io/static/v1?label=VS+Code&message=Container&logo=visualstudiocode&color=007ACC&logoColor=007ACC&labelColor=2C2C32)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/backstage/backstage) ## What is Backstage? From c4bbb4b6bb90219f6e83203e1e2b1c2b66ba0bfc Mon Sep 17 00:00:00 2001 From: Jonathan Nagayoshi Date: Sat, 10 Dec 2022 14:01:35 -0600 Subject: [PATCH 2/2] chore: moved .devcontainer folder to contrib Signed-off-by: Jonathan Nagayoshi --- README.md | 1 - .../.devcontainer}/Dockerfile | 0 contrib/.devcontainer/README.md | 19 +++++++++++++++++++ .../.devcontainer}/devcontainer.json | 3 --- .../.devcontainer}/postCreate.sh | 0 5 files changed, 19 insertions(+), 4 deletions(-) rename {.devcontainer => contrib/.devcontainer}/Dockerfile (100%) create mode 100644 contrib/.devcontainer/README.md rename {.devcontainer => contrib/.devcontainer}/devcontainer.json (89%) rename {.devcontainer => contrib/.devcontainer}/postCreate.sh (100%) diff --git a/README.md b/README.md index 115f1ed6d6..8a2bd338d9 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ ![Code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) [![Codecov](https://img.shields.io/codecov/c/github/backstage/backstage)](https://codecov.io/gh/backstage/backstage) [![](https://img.shields.io/github/v/release/backstage/backstage)](https://github.com/backstage/backstage/releases) -[![VS Code Container](https://img.shields.io/static/v1?label=VS+Code&message=Container&logo=visualstudiocode&color=007ACC&logoColor=007ACC&labelColor=2C2C32)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/backstage/backstage) ## What is Backstage? diff --git a/.devcontainer/Dockerfile b/contrib/.devcontainer/Dockerfile similarity index 100% rename from .devcontainer/Dockerfile rename to contrib/.devcontainer/Dockerfile diff --git a/contrib/.devcontainer/README.md b/contrib/.devcontainer/README.md new file mode 100644 index 0000000000..4fca39b3ad --- /dev/null +++ b/contrib/.devcontainer/README.md @@ -0,0 +1,19 @@ +# Devcontainer Configuration + +[Devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) is a VSCode feature that allows developers +to share a common workspace definition, by leveraging Docker to run the workspace, and using VSCode Remote Development extension, you can make sure the developer experience is the same across different computers + +## Benefits + +- Developers only need to have VSCode and Docker installed +- All dependencies necessary to work in the repository are contained in the docker image +- Makes it easier for new developers to start contributing to the project +- No extra setup required + +## Known Issues + +- Performance is a known issue. Working inside devcontainers require developers to have a powerful computer. See [System Requirements](https://code.visualstudio.com/docs/devcontainers/containers#_system-requirements) + +## Usage + +Just copy the .devcontainer folder to the root of the directory, and VSCode will automatically detect the configuration and suggest that you re-open the repository using Devcontainer diff --git a/.devcontainer/devcontainer.json b/contrib/.devcontainer/devcontainer.json similarity index 89% rename from .devcontainer/devcontainer.json rename to contrib/.devcontainer/devcontainer.json index 075e0c2ec9..b312102784 100644 --- a/.devcontainer/devcontainer.json +++ b/contrib/.devcontainer/devcontainer.json @@ -9,9 +9,6 @@ "ghcr.io/devcontainers-contrib/features/mkdocs:1": {} }, - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - // Use 'forwardPorts' to make a list of ports inside the container available locally. "forwardPorts": [3000, 7007], diff --git a/.devcontainer/postCreate.sh b/contrib/.devcontainer/postCreate.sh similarity index 100% rename from .devcontainer/postCreate.sh rename to contrib/.devcontainer/postCreate.sh