-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🧑💻(gh): Add DevContainer configuration
This DevContainer requires a bit of rework to improve it but it's not planned for now. Signed-off-by: Alexandre Nicolaie <xunleii@users.noreply.github.com>
- Loading branch information
Showing
14 changed files
with
577 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# ignore everything ... | ||
* | ||
|
||
# ... except what is used by the build | ||
!config/etc.docker.pulumi-buildkitd.toml | ||
!config/home.vscode..config.lazygit.config.yaml | ||
!first-run-notice.txt | ||
!scripts/atlas-utils.lib.sh | ||
!scripts/post-create-command.sh | ||
!scripts/post-start-command.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
description: Development environment setup (DevContainer/Codespaces) | ||
files: | ||
devcontainer.json: DevContainer configuration file | ||
Dockerfile: Dockerfile on which the DevContainer is based |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Copyright (C) 2024 Alexandre Nicolaie (xunleii@users.noreply.github.com) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# trunk-ignore-all(trivy/DS026,checkov/CKV_DOCKER_2): This Dockerfile is used for development purposes only, so no need to add HEALTHCHECK instruction | ||
# trunk-ignore-all(trivy/DS002,checkov/CKV_DOCKER_3): The user will be created during the DevContainer build process | ||
# trunk-ignore-all(trivy/DS013): Don't care about this rule | ||
# trunk-ignore-all(hadolint/DL3018): Don't care about pinning the version of packages, as this is a development container and only git is installed | ||
# trunk-ignore-all(hadolint/DL3003): Don't care about WORKDIR instruction, as this will be set by the DevContainer | ||
|
||
|
||
# ┌───────────────────────────────────────────────────────────────────────────┐ | ||
# │ <machine-id>: Generate a machine-id for the container. │ | ||
# | │ | ||
# │ NOTE: This image will be cached (and the machine-id too) in │ | ||
# │ order to have a persistent machine-id even if the │ | ||
# │ image is rebuilt. │ | ||
# └───────────────────────────────────────────────────────────────────────────┘ | ||
FROM docker.io/library/alpine:3.20.1 as machine-id | ||
RUN apk add --no-cache dbus \ | ||
&& dbus-uuidgen > /etc/machine-id | ||
|
||
|
||
# ┌───────────────────────────────────────────────────────────────────────────┐ | ||
# │ <devcontainer>: Create a slim development container with Node.js. │ | ||
# └───────────────────────────────────────────────────────────────────────────┘ | ||
FROM ghcr.io/pulumi/devcontainer:slim-node | ||
|
||
# Install mise package manager | ||
COPY --from=docker.io/jdxcode/mise:v2024.7.3@sha256:d284e59e73c14b5d06074e277f91d80da58909a614ef38f02386adf47e2483d3 /usr/local/bin/mise /usr/local/bin/mise | ||
RUN mise settings set experimental true | ||
|
||
# Install charmbracelet/gum | ||
COPY --from=ghcr.io/charmbracelet/gum:v0.14.1@sha256:01028e2f2c3d9c80f415f87a4599e539b1bee0c9efa602a225b89eb4d14c2a2a /usr/local/bin/gum /usr/local/bin/gum | ||
|
||
# Copy generated machine-id | ||
COPY --from=machine-id /etc/machine-id /etc/machine-id | ||
|
||
COPY scripts/atlas-utils.lib.sh /usr/local/share/atlas-utils.lib.sh | ||
COPY --chmod=755 scripts/post-create-command.sh /usr/local/share/post-create-command.sh | ||
COPY --chmod=755 scripts/post-start-command.sh /usr/local/share/post-start-command.sh | ||
|
||
COPY --chown=vscode:vscode config/home.vscode..config.lazygit.config.yaml /home/vscode/.config/lazygit/config.yml | ||
COPY config/etc.docker.pulumi-buildkitd.toml /etc/docker/pulumi-buildkitd.toml | ||
COPY first-run-notice.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (C) 2024 Alexandre Nicolaie (xunleii@users.noreply.github.com) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ---------------------------------------------------------------------------- | ||
debug = true | ||
insecure-entitlements = ["network.host", "security.insecure"] | ||
|
||
[registry."oci.local.chezmoi.sh:5000"] | ||
http = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright (C) 2024 Alexandre Nicolaie (xunleii@users.noreply.github.com) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ---------------------------------------------------------------------------- | ||
--- | ||
version: 0.1 | ||
log: | ||
fields: | ||
service: registry | ||
storage: | ||
delete: | ||
enabled: true | ||
cache: | ||
blobdescriptor: inmemory | ||
filesystem: | ||
rootdirectory: /var/lib/registry | ||
http: | ||
addr: :80 | ||
headers: | ||
X-Content-Type-Options: [nosniff] | ||
Access-Control-Allow-Origin: ["*"] | ||
Access-Control-Allow-Methods: [HEAD, GET, OPTIONS, DELETE] | ||
Access-Control-Allow-Headers: [Authorization, Accept] | ||
Access-Control-Max-Age: [1728000] | ||
Access-Control-Allow-Credentials: [true] | ||
Access-Control-Expose-Headers: [Docker-Content-Digest] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"distSpecVersion": "1.1.0", | ||
"extensions": { | ||
"metrics": {}, | ||
"search": { | ||
"cve": { | ||
"updateInterval": "2h" | ||
} | ||
}, | ||
"ui": { | ||
"enable": true | ||
} | ||
}, | ||
"http": { | ||
"address": "0.0.0.0", | ||
"port": 5000 | ||
}, | ||
"log": { | ||
"level": "debug" | ||
}, | ||
"storage": { | ||
"commit": true, | ||
"dedupe": true, | ||
"remoteCache": false, | ||
"retention": { | ||
"delay": "15m", | ||
"policies": [ | ||
{ | ||
"repositories": ["**"], | ||
"deleteReferrers": true, | ||
"deleteUntagged": true, | ||
"keepTags": [ | ||
{ | ||
"patterns": [".*"], | ||
"pushedWithin": "12h" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"rootDirectory": "/tmp/zot" | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
.devcontainer/config/home.vscode..config.lazygit.config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (C) 2024 Alexandre Nicolaie (xunleii@users.noreply.github.com) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ---------------------------------------------------------------------------- | ||
--- | ||
git: | ||
commit: | ||
signOff: true | ||
overrideGpg: true | ||
parseEmoji: true | ||
customCommands: | ||
- command: czg --signoff --gpg-sign | ||
context: files | ||
description: Run commitizen to commit files | ||
key: c | ||
loadingText: Opening git cz - Loading... | ||
subprocess: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"features": { | ||
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": { | ||
"version": "0.0.4", | ||
"resolved": "ghcr.io/devcontainers-contrib/features/zsh-plugins@sha256:df477db6ecd0dd4b4a1d3434c627a06c783a0f1c3f64c68d69d2ecdf7a1c8196", | ||
"integrity": "sha256:df477db6ecd0dd4b4a1d3434c627a06c783a0f1c3f64c68d69d2ecdf7a1c8196" | ||
}, | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"version": "2.4.3", | ||
"resolved": "ghcr.io/devcontainers/features/common-utils@sha256:e9e1d402031416ed5fc500f242c27ffa1043a27b5ba612e6596ea62503c8ae70", | ||
"integrity": "sha256:e9e1d402031416ed5fc500f242c27ffa1043a27b5ba612e6596ea62503c8ae70" | ||
}, | ||
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": { | ||
"version": "1.5.0", | ||
"resolved": "ghcr.io/devcontainers/features/docker-outside-of-docker@sha256:20761bd733511c1995ee955682cc2778b0a2e556abf88e9b88490c3be3c80bbc", | ||
"integrity": "sha256:20761bd733511c1995ee955682cc2778b0a2e556abf88e9b88490c3be3c80bbc" | ||
}, | ||
"ghcr.io/devcontainers/features/go:1.3.0": { | ||
"version": "1.3.0", | ||
"resolved": "ghcr.io/devcontainers/features/go@sha256:6adad519ea1b49989de42ce5bde5add32748cae68eeb6034db4c2d69e87c161b", | ||
"integrity": "sha256:6adad519ea1b49989de42ce5bde5add32748cae68eeb6034db4c2d69e87c161b" | ||
}, | ||
"ghcr.io/devcontainers/features/rust:1.2.0": { | ||
"version": "1.2.0", | ||
"resolved": "ghcr.io/devcontainers/features/rust@sha256:87e1306eef9c1bbc3896e65af91c520f2e78f520d1c2e183ee27c2b11a9397ef", | ||
"integrity": "sha256:87e1306eef9c1bbc3896e65af91c520f2e78f520d1c2e183ee27c2b11a9397ef" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
/* | ||
* Copyright (C) 2024 Alexandre Nicolaie (xunleii@users.noreply.github.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ---------------------------------------------------------------------------- | ||
*/ | ||
|
||
// Reference: | ||
// - https://containers.dev/features | ||
// - https://containers.dev/implementors/features | ||
// - https://code.visualstudio.com/docs/getstarted/settings | ||
{ | ||
"name": "chezmoi.sh/atlas Codespace", | ||
"dockerComposeFile": "docker-compose.yaml", | ||
"service": "vscode", | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"dev.containers.copyGitConfig": true, | ||
"editor.defaultFormatter": "trunk.io", | ||
"editor.gotoLocation.multipleDeclarations": "goto", | ||
"editor.gotoLocation.multipleDefinitions": "goto", | ||
"editor.gotoLocation.multipleImplementations": "goto", | ||
"editor.gotoLocation.multipleReferences": "goto", | ||
"editor.gotoLocation.multipleTypeDefinitions": "goto", | ||
"editor.minimap.enabled": true, | ||
"editor.quickSuggestionsDelay": 0, | ||
"editor.snippetSuggestions": "top", | ||
"editor.suggestSelection": "first", | ||
"editor.terminal.integrated.shell.linux": "/usr/bin/zsh", | ||
"explorer.openEditors.visible": 1, | ||
"files.associations": { | ||
".folderinfo": "yaml" | ||
}, | ||
"files.trimFinalNewlines": true, | ||
"files.trimTrailingWhitespace": true, | ||
"prettier.configPath": ".trunk/configs/.prettierrc.yaml", | ||
"prettier.ignorePath": ".trunk/configs/.prettierignore", | ||
"psi-header.changes-tracking": { | ||
"autoHeader": "manualSave", | ||
"enabled": true, | ||
"enforceHeader": true, | ||
"excludeGlob": ["*.json", "*.spec.ts"], | ||
"exclude": [".folderinfo"], | ||
"replace": ["Copyright (C)"] | ||
}, | ||
"psi-header.config": { | ||
"blankLinesAfter": 1, | ||
"forceToTop": true, | ||
"license": "Apache-2.0", | ||
"spacesBetweenYears": true | ||
}, | ||
"psi-header.templates": [ | ||
{ | ||
"language": "*", | ||
"template": [ | ||
"Copyright (C) <<yeartoyear(fc!P, now)>> <<author>> (<<authoremail>>)", | ||
"", | ||
"Licensed under the Apache License, Version 2.0 (the \"License\");", | ||
"you may not use this file except in compliance with the License.", | ||
"You may obtain a copy of the License at", | ||
"", | ||
" http://www.apache.org/licenses/LICENSE-2.0", | ||
"", | ||
"Unless required by applicable law or agreed to in writing, software", | ||
"distributed under the License is distributed on an \"AS IS\" BASIS,", | ||
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", | ||
"See the License for the specific language governing permissions and", | ||
"limitations under the License.", | ||
"----------------------------------------------------------------------------" | ||
] | ||
} | ||
], | ||
"psi-header.lang-config": [ | ||
// Default configuration | ||
{ | ||
"language": "*", | ||
"blankLinesAfter": 1, | ||
"ignoreLines": ["Copyright (C)"], | ||
"prefix": "# " | ||
}, | ||
|
||
// YAML like comments configuration (YAML, TOML, Dockerfile, etc.) | ||
{ | ||
"language": "yaml", | ||
"begin": "", | ||
"end": "", | ||
"blankLinesAfter": 0, | ||
"prefix": "# " | ||
}, | ||
{ "language": "dockerfile", "mapTo": "yaml" }, | ||
{ "language": "shellscript", "mapTo": "yaml" }, | ||
{ "language": "ignore", "mapTo": "yaml" } | ||
] | ||
}, | ||
"extensions": [ | ||
"bierner.github-markdown-preview", | ||
"bierner.markdown-preview-github-styles", | ||
"github.copilot", | ||
"GitHub.vscode-pull-request-github", | ||
"ldez.ignore-files", | ||
"ms-azuretools.vscode-docker", | ||
"ms-vscode-remote.remote-containers", | ||
"psioniq.psi-header", | ||
"redhat.vscode-yaml", | ||
"Terrastruct.d2", | ||
"tamasfe.even-better-toml", | ||
"trunk.io", | ||
"visualstudioexptteam.vscodeintellicode" | ||
] | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"installZsh": true, | ||
"configureZshAsDefaultShell": true, | ||
"installOhMyZsh": true, | ||
"installOhMyZshConfig": true, | ||
"upgradePackages": true, | ||
"nonFreePackages": true, | ||
"username": "vscode", | ||
"userUid": "automatic", | ||
"userGid": "automatic" | ||
}, | ||
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": { | ||
"moby": false, | ||
"installDockerBuildx": true, | ||
"version": "latest", | ||
"dockerDashComposeVersion": "v2" | ||
}, | ||
"ghcr.io/devcontainers/features/go:1.3.0": {}, | ||
"ghcr.io/devcontainers/features/rust:1.2.0": {}, | ||
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": { | ||
"plugins": "direnv docker node yarn" | ||
} | ||
}, | ||
"postCreateCommand": "/usr/local/share/post-create-command.sh", | ||
"postStartCommand": "/usr/local/share/post-start-command.sh", | ||
"forwardPorts": [80, 5000], | ||
"remoteUser": "vscode", | ||
"workspaceFolder": "/workspaces/atlas" | ||
} |
Oops, something went wrong.