{"id":17550923,"url":"https://github.com/iancleary/devcontainer","last_synced_at":"2025-03-07T03:30:56.922Z","repository":{"id":173830446,"uuid":"651332304","full_name":"iancleary/devcontainer","owner":"iancleary","description":"Container meant to be used in a devcontainer.json file within Visual Studio Code","archived":true,"fork":false,"pushed_at":"2023-10-07T02:59:54.000Z","size":124,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-13T03:48:47.693Z","etag":null,"topics":["devcontainer","docker","dockerfile","vscode"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iancleary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-09T02:42:42.000Z","updated_at":"2024-05-08T19:01:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"75e9fe8c-9db0-40f1-bbda-3dba9ff3e86e","html_url":"https://github.com/iancleary/devcontainer","commit_stats":null,"previous_names":["iancleary/devcontainer"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iancleary%2Fdevcontainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iancleary%2Fdevcontainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iancleary%2Fdevcontainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iancleary%2Fdevcontainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iancleary","download_url":"https://codeload.github.com/iancleary/devcontainer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242326577,"owners_count":20109398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devcontainer","docker","dockerfile","vscode"],"created_at":"2024-10-21T04:44:20.603Z","updated_at":"2025-03-07T03:30:56.598Z","avatar_url":"https://github.com/iancleary.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# devcontainer docker image\n\n\u003c!-- markdownlint-disable MD033 --\u003e\n\u003cp align=\"center\"\u003e\n    \u003cem\u003eContainer meant to be used in a devcontainer.json file within Visual Studio Code\u003c/em\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/iancleary/devcontainer/actions/workflows/publish.yml\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/iancleary/devcontainer/actions/workflows/publish.yml/badge.svg?event=release\" alt=\"Publish Workflow status on Release event\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\u003c!-- markdownlint-enable MD033 --\u003e\n\nImages are built and pushed to DockerHub and GitHub container registery automatically on releases.\n\n## Devcontainer\n\n\u003e The Visual Studio Code Dev Containers extension lets you use a Docker container as a full-featured development environment. It allows you to open any folder or repository inside a container and take advantage of Visual Studio Code's full feature set. A devcontainer.json file in your project tells VS Code how to access (or create) a development container with a well-defined tool and runtime stack. This container can be used to run an application or to provide separate tools, libraries, or runtimes needed for working with a codebase\n\n\u003chttps://code.visualstudio.com/docs/devcontainers/create-dev-container\u003e\n\n## Custom Software\n\nCustom software, such as [rust], [python], or [node] is expected to be installed with [nix] [flakes], which are both installed in the [Dockerfile](./Dockerfile).\n\nThis image allows [direnv] to be setup to use [nix] [flakes] to install software on the loading of your code directory.\n\nExamples of this can be found in the [dev-templates] repository.\n\nThis image is used primarily to have the same packaging workflow on Windows as we do on MacOS or Linux operating systems.\nAs we prefer to keep our operating systems clean, the project repository that uses this devcontainer should declaritively show all needed dependencies in their `flake.nix` file.\n\nOne could make separate images for each language, but I prefer to have one image for all my development needs as the size of this alpine based image is small enough for my needs.\n\n## Custom Preferences\n\nI installed ohmyzsh, along with powerlevel10k in the [Dockerfile](./Dockerfile).\n\nFor powerlevel10k, the [fonts](https://github.com/romkatv/powerlevel10k#manual-font-installation) needs to be installed on the host/client machine, not inside the container.\n\n## .devcontainer/devcontainer.json\n\nAs is, with no configuration\n\n```json\n{\n  \"image\": \"ghcr.io/iancleary/devcontainer:tag\",\n  \"remoteUser\": \"root\"\n}\n```\n\nWith a Dockerfile in the `.devcontainer` folder\n\n```json\n{\n  \"build\": {\n    \"dockerfile\": \"Dockerfile\"\n  },\n  \"remoteUser\": \"root\"\n}\n```\n\nWith a Dockerfile in the root of the project\n\n```json\n{\n  \"build\": {\n    \"dockerfile\": \"../Dockerfile\"\n  },\n  \"remoteUser\": \"root\"\n}\n```\n\nRecommended way to install packages with [nix] [flakes] and [direnv] in the `flake.nix` and `.envrc` files within your repo, not the Dockerfile:\n\n`.envrc`\n\n```bash\nuse flake .\n\n```\n\n`flake.nix` example from [dev-templates]'s python directory\n\n````nix\n{\n  description = \"A Nix-flake-based Python development environment\";\n\n  # GitHub URLs for the Nix inputs we're using\n  inputs = {\n    # Simply the greatest package repository on the planet\n    nixpkgs.url = \"github:NixOS/nixpkgs\";\n    # A set of helper functions for using flakes\n    flake-utils.url = \"github:numtide/flake-utils\";\n  };\n\n  outputs = { self, nixpkgs, flake-utils, mach-nix }:\n    flake-utils.lib.eachDefaultSystem (system:\n      let\n        pkgs = import nixpkgs { inherit system; };\n\n        # task runner\n        just = pkgs.just;\n\n        # Python 3.11\n        python = pkgs.python311;\n\n        # Run python packages in a isolated environment\n        pipx = pkgs.python311Packages.pipx;\n\n        # Python tools, as a list\n        pythonTools = [ python pipx];\n      in {\n        devShells = {\n          default = pkgs.mkShell {\n            # Packages included in the environment\n            buildInputs = [ just ] ++ pythonTools;\n\n            # Run when the shell is started up\n            shellHook = ''\n              ${python}/bin/python --version\n              ${python}/bin/python -m venv .venv\n              source .venv/bin/activate\n              export PIPX_HOME=.venv/pipx\n              export PIPX_BIN_DIR=.venv/bin\n              echo \"pipx $(pipx --version)\"\n              pipx install pdm\n              pipx install pre-commit\n              pdm --version\n              pdm install\n              pre-commit --version\n              pre-commit install\n            '';\n\n            # https://pypa.github.io/pipx/docs/\n            # optional environment variables:\n            #   PIPX_HOME             Overrides default pipx location. Virtual Environments\n            #                         will be installed to $PIPX_HOME/venvs.\n            #   PIPX_BIN_DIR          Overrides location of app installations. Apps are\n            #                         symlinked or copied here.\n            #\n          };\n        };\n      });\n}\n```g\n\n[dev-templates]: https://github.com/iancleary/dev-templates\n[flakes]: https://nixos.wiki/wiki/Flakes\n[nix]: https://nixos.org\n[node]: https://nodejs.org\n[proto]: https://developers.google.com/protocol-buffers\n[python]: https://python.org\n[rust]: https://rust-lang.org\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiancleary%2Fdevcontainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiancleary%2Fdevcontainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiancleary%2Fdevcontainer/lists"}