From 1a0d7106a425f6e05ae25e43fa30688413a2ed50 Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 18 Jan 2024 08:29:13 -0800 Subject: [PATCH] Add a devcontainer config (#807) Summary: Add a devcontainer config My laptop is full of weird versions of weird tools. Sapling requires specific versions of specific tools. It's nice to be able to open the sapling folder in vscode and get a prompt for "would you like to do your development inside a container with all the correct tools pre-installed?" :) This also allows people on github to click a button to open in github's web-based container-IDE and start developing without installing anything at all, though I don't know if we'd expect anybody to do that For starters I'm using the CI build image without changes to try and keep the maintenance burden as small as possible, though it would be possible to use a separate layer within the Dockerfile (eg if we wanted to install extra tools that are useful for dev but not needed for building), or have a totally separate Dockerfile --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/sapling/pull/807). * __->__ https://github.com/facebook/sapling/issues/807 * https://github.com/facebook/sapling/issues/806 * https://github.com/facebook/sapling/issues/804 Pull Request resolved: https://github.com/facebook/sapling/pull/807 Differential Revision: D52575911 Pulled By: quark-zju fbshipit-source-id: b24e1a21493f18a06355c984a72936cd11fef2ea --- .devcontainer/README.md | 2 ++ .devcontainer/devcontainer.json | 22 +++++++++++++++++++ .../sapling-cli-ubuntu-20.04.Dockerfile | 3 ++- .../sapling-cli-ubuntu-22.04.Dockerfile | 3 ++- ci/gen_workflows.py | 3 +++ 5 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/README.md create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000000..0ff88abf94 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,2 @@ +For format details, see https://aka.ms/devcontainer.json +For config options, see the README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..794b72fd7c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,22 @@ +{ + "name": "Sapling", + "build": { + "context": "..", + "dockerfile": "../.github/workflows/sapling-cli-ubuntu-22.04.Dockerfile" + }, + "updateContentCommand": "ln -sf /workspaces/sapling/eden/scm/sl /usr/local/bin/sl", + "customizations": { + "vscode": { + "extensions": [ + "ms-azuretools.vscode-docker", + "ms-python.python", + "rust-lang.rust-analyzer" + ], + "settings": { + "rust-analyzer.linkedProjects": [ + "/workspaces/sapling/eden/scm/Cargo.toml" + ] + } + } + } +} diff --git a/.github/workflows/sapling-cli-ubuntu-20.04.Dockerfile b/.github/workflows/sapling-cli-ubuntu-20.04.Dockerfile index 8e035b4fb6..c6a6f16bc5 100644 --- a/.github/workflows/sapling-cli-ubuntu-20.04.Dockerfile +++ b/.github/workflows/sapling-cli-ubuntu-20.04.Dockerfile @@ -18,7 +18,8 @@ RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesourc # Now we can install the bulk of the packages: RUN apt-get -y update -RUN apt-get -y install nodejs pkg-config libssl-dev cython3 make g++ dpkg-dev python3.8 python3.8-dev python3.8-distutils +RUN apt-get -y install nodejs pkg-config libssl-dev cython3 make g++ dpkg-dev gettext locales python3.8 python3.8-dev python3.8-distutils +RUN locale-gen en_US.UTF-8 # Unfortunately, we cannot `apt install cargo` because at the time of this # writing, it installs a version of cargo that is too old (1.59). Specifically, diff --git a/.github/workflows/sapling-cli-ubuntu-22.04.Dockerfile b/.github/workflows/sapling-cli-ubuntu-22.04.Dockerfile index 559569b26d..12bfddd44f 100644 --- a/.github/workflows/sapling-cli-ubuntu-22.04.Dockerfile +++ b/.github/workflows/sapling-cli-ubuntu-22.04.Dockerfile @@ -18,7 +18,8 @@ RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesourc # Now we can install the bulk of the packages: RUN apt-get -y update -RUN apt-get -y install nodejs pkg-config libssl-dev cython3 make g++ dpkg-dev python3.10 python3.10-dev python3.10-distutils +RUN apt-get -y install nodejs pkg-config libssl-dev cython3 make g++ dpkg-dev gettext locales python3.10 python3.10-dev python3.10-distutils +RUN locale-gen en_US.UTF-8 # Unfortunately, we cannot `apt install cargo` because at the time of this # writing, it installs a version of cargo that is too old (1.59). Specifically, diff --git a/ci/gen_workflows.py b/ci/gen_workflows.py index c2856c377a..23dab00e55 100755 --- a/ci/gen_workflows.py +++ b/ci/gen_workflows.py @@ -37,6 +37,8 @@ UBUNTU_DEPS = [ "g++", # This is needed for dpkg-name. "dpkg-dev", + "gettext", + "locales", ] MACOS_RELEASES = { @@ -116,6 +118,7 @@ RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesourc # Now we can install the bulk of the packages: RUN apt-get -y update RUN apt-get -y install {' '.join(full_deps)} +RUN locale-gen en_US.UTF-8 # Unfortunately, we cannot `apt install cargo` because at the time of this # writing, it installs a version of cargo that is too old (1.59). Specifically,