diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..dc2d0fc9f --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,27 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/go +{ + "name": "flyteidl", + "dockerComposeFile": "../docker-compose.devcontainer.yml", + "service": "devcontainer", + + "workspaceFolder": "/usr/src/flyteidl", + + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "go.toolsManagement.checkForUpdates": "local", + "go.useLanguageServer": true, + "go.gopath": "/go" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "golang.Go" + ] + } + } +} diff --git a/README.md b/README.md index a1be04d74..f17d9de2e 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,15 @@ This is one of the core repositories of Flyte. It contains the Specification of ## Tooling for Flyteidl -1. Run ``make download_tooling`` to install generator dependencies. +1. Ensure Docker is installed locally. + +2. If using Visual Studio Code, open the project in dev container. If not, run `docker-compose up` to start a dev container, and `docker-compose exec devcontainer bash` to SSH into it. ```bash - make download_tooling + docker-compose up -d + docker-compose exec devcontainer bash ``` -2. Ensure Docker is installed locally. 3. Run ``make generate`` to generate all the code, mock client, and docs for FlyteAdmin Service. ```bash diff --git a/devcontainer.Dockerfile b/devcontainer.Dockerfile new file mode 100644 index 000000000..0ca83b442 --- /dev/null +++ b/devcontainer.Dockerfile @@ -0,0 +1,11 @@ +FROM golang:1.18.5 + +WORKDIR /usr/src/flyteidl + +COPY Makefile ./ +COPY boilerplate ./boilerplate +COPY go.mod ./ +COPY go.sum ./ + +# install tools and dependencies +RUN make update_boilerplate install diff --git a/docker-compose.devcontainer.yml b/docker-compose.devcontainer.yml new file mode 100644 index 000000000..27bfe12d6 --- /dev/null +++ b/docker-compose.devcontainer.yml @@ -0,0 +1,18 @@ +version: '3.8' + +services: + devcontainer: + build: + context: . + dockerfile: devcontainer.Dockerfile + volumes: + - ./:/usr/src/flyteidl:cached + + # Required for debugging + cap_add: + - SYS_PTRACE + security_opt: + - seccomp:unconfined + + # Overrides default command so things don't shut down after the process ends. + command: /bin/sh -c "while sleep 1000; do :; done"