Skip to content

Commit 5d202cd

Browse files
Added template files
1 parent c28f982 commit 5d202cd

File tree

112 files changed

+25855
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+25855
-2
lines changed

β€Ž.copier-answers.yamlβ€Ž

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: 746263f
3+
_src_path: ./
4+
accountname: quickplates
5+
description: Litestar service example 🌠
6+
docs: true
7+
docsurl: https://quickplates.github.io/litestar-example
8+
envprefix: LITESTAR_EXAMPLE
9+
imagename: services/litestar-example
10+
importname: litestar_example
11+
port: 8080
12+
registry: true
13+
releases: true
14+
reponame: litestar-example
15+
repourl: https://github.com/quickplates/litestar-example
16+
servicename: litestar-example
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"build": {
3+
"context": "image/",
4+
"dockerfile": "image/Dockerfile",
5+
"options": ["--network=host"]
6+
},
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"jnoortheen.nix-ide",
11+
"mkhl.direnv",
12+
"ms-python.python",
13+
"tamasfe.even-better-toml",
14+
"task.vscode-task",
15+
"Trunk.io"
16+
],
17+
"settings": {
18+
"[nix]": {
19+
"editor.defaultFormatter": "jnoortheen.nix-ide"
20+
},
21+
"editor.defaultFormatter": "trunk.io",
22+
"nix.enableLanguageServer": true,
23+
"nix.serverPath": "nil",
24+
"nix.serverSettings": {
25+
"nil": {
26+
"formatting": {
27+
"command": ["nix", "fmt", "--", "-"]
28+
}
29+
}
30+
},
31+
"python.analysis.nodeExecutable": "auto",
32+
"remote.autoForwardPorts": false
33+
}
34+
}
35+
},
36+
"features": {
37+
"ghcr.io/devcontainers-extra/features/direnv:1.0.3": {
38+
"version": "2.37.1"
39+
},
40+
"ghcr.io/devcontainers-extra/features/starship:1.0.10": {
41+
"version": "1.24.0"
42+
},
43+
"ghcr.io/devcontainers/features/docker-in-docker:2.12.4": {
44+
"version": "28.5.1"
45+
},
46+
"ghcr.io/devcontainers/features/nix:1.2.0": {
47+
"extraNixConfig": "experimental-features = nix-command flakes",
48+
"version": "2.28.5"
49+
}
50+
},
51+
"mounts": [
52+
"source=devcontainer-shared-secrets,target=/secrets/,type=volume",
53+
"source=devcontainer-${devcontainerId}-nix,target=/nix/,type=volume",
54+
"source=devcontainer-${devcontainerId}-shellhistory-persist,target=/persist/shellhistory/,type=volume",
55+
"source=devcontainer-shared-trunk-cache,target=/cache/trunk/,type=volume",
56+
"source=devcontainer-shared-uv-cache,target=/cache/uv/,type=volume",
57+
"source=devcontainer-shared-npm-cache,target=/cache/npm/,type=volume"
58+
],
59+
"onCreateCommand": "/hooks/create.sh",
60+
"remoteEnv": {
61+
"WORKSPACE": "${containerWorkspaceFolder}"
62+
},
63+
"runArgs": [
64+
"--uts=host",
65+
"--ipc=host",
66+
"--network=host",
67+
"--userns=host",
68+
"--cgroupns=host",
69+
"--privileged"
70+
]
71+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Using one of the offical dev container images as base
2+
# Going with Ubuntu, because it has glibc, which some tools might need
3+
# It also has git, zsh and a bunch of other stuff preinstalled
4+
# Also, it includes a non-root 'vscode' user with sudo access
5+
# The version is pinned to ensure reproducibility
6+
FROM mcr.microsoft.com/devcontainers/base:1.2.6-ubuntu-24.04
7+
8+
ENV REMOTE_USER=vscode
9+
10+
# Setup script
11+
COPY setup.sh /tmp/setup.sh
12+
13+
RUN /tmp/setup.sh && \
14+
rm /tmp/setup.sh
15+
16+
# Lifecycle hooks
17+
COPY hooks/ /hooks/
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
# Create shell history cache files if they don't exist for some reason
4+
touch /persist/shellhistory/.bash_history
5+
touch /persist/shellhistory/.zsh_history
6+
7+
# Use GitHub token secret if it exists
8+
if [[ -s /secrets/.ghtoken && -r /secrets/.ghtoken ]]; then
9+
token="$(cat /secrets/.ghtoken)"
10+
confighome="${XDG_CONFIG_HOME:-${HOME}/.config/}"
11+
12+
# Add GitHub token to Nix config
13+
configfile="${confighome}/nix/nix.conf"
14+
tmpfile="$(mktemp)"
15+
16+
mkdir --parents "$(dirname "${configfile}")"
17+
touch "${configfile}"
18+
19+
if grep --quiet extra-access-tokens "${configfile}"; then
20+
sed "s|extra-access-tokens.*|extra-access-tokens = github.com=${token}|" "${configfile}" >"${tmpfile}"
21+
cat "${tmpfile}" >"${configfile}"
22+
rm "${tmpfile}"
23+
else
24+
echo "extra-access-tokens = github.com=${token}" >>"${configfile}"
25+
fi
26+
fi

β€Ž.devcontainer/image/setup.shβ€Ž

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env bash
2+
3+
REMOTE_USER="${REMOTE_USER:?}"
4+
REMOTE_USER_PASSWD="$(getent passwd "${REMOTE_USER}")"
5+
REMOTE_USER_HOME="$(echo "${REMOTE_USER_PASSWD}" | cut --delimiter ':' --fields 6)"
6+
7+
# Setup default shell
8+
chsh --shell /usr/bin/zsh "${REMOTE_USER}"
9+
10+
# Setup direnv
11+
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
12+
eval "\$(direnv hook bash)"
13+
EOF
14+
15+
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
16+
eval "\$(direnv hook zsh)"
17+
EOF
18+
19+
# Setup starship
20+
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
21+
eval "\$(starship init bash)"
22+
EOF
23+
24+
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
25+
eval "\$(starship init zsh)"
26+
EOF
27+
28+
# Setup secrets directory
29+
mkdir --parents /secrets/
30+
31+
chown --recursive "${REMOTE_USER}:" /secrets/
32+
33+
# Setup shell history cache
34+
mkdir --parents /persist/shellhistory/
35+
36+
touch /persist/shellhistory/.bash_history
37+
touch /persist/shellhistory/.zsh_history
38+
39+
chown --recursive "${REMOTE_USER}:" /persist/shellhistory/
40+
41+
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
42+
export HISTFILE=/persist/shellhistory/.bash_history
43+
EOF
44+
45+
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
46+
export HISTFILE=/persist/shellhistory/.zsh_history
47+
EOF
48+
49+
# Setup trunk cache
50+
mkdir --parents /cache/trunk/
51+
52+
chown --recursive "${REMOTE_USER}:" /cache/trunk/
53+
54+
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
55+
export TRUNK_CACHE=/cache/trunk/
56+
EOF
57+
58+
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
59+
export TRUNK_CACHE=/cache/trunk/
60+
EOF
61+
62+
# Setup uv cache
63+
mkdir --parents /cache/uv/
64+
65+
chown --recursive "${REMOTE_USER}:" /cache/uv/
66+
67+
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
68+
export UV_CACHE_DIR=/cache/uv/
69+
export UV_LINK_MODE=copy
70+
EOF
71+
72+
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
73+
export UV_CACHE_DIR=/cache/uv/
74+
export UV_LINK_MODE=copy
75+
EOF
76+
77+
# Setup npm cache
78+
mkdir --parents /cache/npm/
79+
80+
chown --recursive "${REMOTE_USER}:" /cache/npm/
81+
82+
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
83+
export NPM_CONFIG_CACHE=/cache/npm/
84+
EOF
85+
86+
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
87+
export NPM_CONFIG_CACHE=/cache/npm/
88+
EOF

β€Ž.dockerignoreβ€Ž

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#Task
2+
/.task/
3+
/Taskfile.yaml
4+
/Taskfile.yml
5+
6+
# Misc
7+
.DS_Store
8+
.todo
9+
10+
# Byte-compiled / optimized / DLL files
11+
__pycache__/
12+
*.py[cod]
13+
*$py.class
14+
15+
# C extensions
16+
*.so
17+
18+
# Pytest
19+
.pytest_cache/
20+
21+
# Environment
22+
/.venv/
23+
24+
# Tracked, but not needed
25+
/.devcontainer/
26+
/.github/
27+
/.trunk/
28+
/.vscode/
29+
/docs/
30+
/tests/
31+
/.copier-answers.yaml
32+
/.dockerignore
33+
/.envrc
34+
/.gitattributes
35+
/.gitignore
36+
/CONTRIBUTING.md
37+
/docker-compose.yaml
38+
/Dockerfile
39+
/LICENSE
40+
/README.md
41+
/Taskfile.dist.yaml

β€Ž.envrcβ€Ž

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
# reload when these files change
4+
watch_file flake.lock ./*.nix
5+
6+
# activate the default development shell in the current shell
7+
# --accept-flake-config will accept the nix configuration from the flake without prompting
8+
eval "$(nix print-dev-env path:./ --accept-flake-config)" || true

β€Ž.gitattributesβ€Ž

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Mark everything as vendored
2+
* linguist-vendored
3+
# Treat docs as documentation
4+
/docs/** -linguist-vendored linguist-documentation
5+
# Unmark files in src, so that they are included in language stats
6+
/src/** -linguist-vendored
7+
# Treat tests as documentation
8+
/tests/** -linguist-vendored linguist-documentation

β€Ž.github/release.yamlβ€Ž

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
changelog:
2+
exclude:
3+
# Exclude PRs with the following labels from the changelog
4+
labels:
5+
- skip-changelog
6+
# Categories are used make sections in the changelog based on PR labels
7+
categories:
8+
- title: πŸš€ Features
9+
labels:
10+
- feature
11+
- title: πŸ› Bug Fixes
12+
labels:
13+
- bug
14+
- title: 🧽 Cleanup
15+
labels:
16+
- cleanup

0 commit comments

Comments
Β (0)