Skip to content

Commit 130fdb7

Browse files
committed
add devcontainer
1 parent 266280a commit 130fdb7

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed

.devcontainer/.bash_local

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
if command -v mise >/dev/null 2>&1; then
4+
eval "$(mise activate bash)"
5+
fi

.devcontainer/Dockerfile

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
FROM mcr.microsoft.com/devcontainers/base:dev-ubuntu24.04 AS base
2+
3+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4+
5+
ARG DEBIAN_FRONTEND=noninteractive
6+
7+
# ✅ Locale / Users / Paths
8+
ENV TZ=Asia/Tokyo \
9+
LANG=ja_JP.UTF-8 \
10+
LANGUAGE=ja_JP:ja \
11+
LC_ALL=ja_JP.UTF-8
12+
13+
ENV USERNAME=vscode
14+
ENV USER_HOME=/home/${USERNAME}
15+
ENV USER_LOCAL=${USER_HOME}/.local
16+
ENV USER_LOCAL_BIN=${USER_LOCAL}/bin
17+
ENV USER_CONFIG=${USER_HOME}/.config
18+
ENV WORK_DIR=${USER_HOME}/workspaces/androiddagashi.github.io
19+
20+
# ✅ XDG(mise/aqua が参照)
21+
ENV XDG_CACHE_HOME=${USER_HOME}/.cache
22+
ENV XDG_STATE_HOME=${USER_HOME}/.local/state
23+
ENV MISE_CACHE_DIR=${XDG_CACHE_HOME}/mise
24+
ENV MISE_DATA_DIR=${USER_LOCAL}/share/mise
25+
26+
ENV PATH="${MISE_DATA_DIR}}/shims:${USER_LOCAL_BIN}:$PATH"
27+
28+
USER root
29+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
30+
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
31+
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
32+
echo $TZ > /etc/timezone && \
33+
apt-get update && \
34+
apt-get install -y --no-install-recommends \
35+
locales sudo gnupg2 iptables ipset dnsutils gh jq vim curl ca-certificates wget \
36+
python3 python3-pip pipx && \
37+
sed -i 's/# ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/' /etc/locale.gen && \
38+
locale-gen ja_JP.UTF-8 && \
39+
update-locale LANG=$LANG && \
40+
install -d -m 0755 -o ${USERNAME} -g ${USERNAME} \
41+
${WORK_DIR} \
42+
${USER_LOCAL_BIN} \
43+
${USER_LOCAL}/bash_completion.d \
44+
${USER_CONFIG}/.ssh \
45+
${USER_CONFIG}/ksm \
46+
${USER_CONFIG}/aqua \
47+
${USER_HOME}/.claude \
48+
${USER_HOME}/.codex \
49+
${USER_HOME}/.copilot \
50+
${XDG_CACHE_HOME} \
51+
${XDG_CACHE_HOME}/aquaproj-aqua \
52+
${MISE_CACHE_DIR} \
53+
${MISE_DATA_DIR} \
54+
${MISE_DATA_DIR}/installs/node \
55+
${MISE_DATA_DIR}/downloads \
56+
${MISE_DATA_DIR}/lockfiles \
57+
${AQUA_ROOT_DIR} \
58+
${AQUA_BIN} \
59+
${XDG_STATE_HOME} \
60+
${XDG_STATE_HOME}/mise && \
61+
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} && \
62+
chmod 0440 /etc/sudoers.d/${USERNAME} && \
63+
chown -R ${USERNAME}:${USERNAME} ${USER_HOME}/.cache ${USER_LOCAL} ${USER_CONFIG} && \
64+
apt-get clean && \
65+
rm -rf /var/lib/apt/lists/*
66+
67+
USER ${USERNAME}
68+
69+
COPY --chown=vscode:vscode mise.toml ${USER_CONFIG}/mise/config.toml
70+
71+
RUN curl https://mise.run | sh && \
72+
mise trust "${USER_CONFIG}/mise/config.toml" && \
73+
mise install
74+
75+
WORKDIR /workspace

.devcontainer/devcontainer.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "Node.js",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": "..",
6+
"args": {
7+
"TZ": "${localEnv:TZ:Japan/Tokyo}"
8+
}
9+
},
10+
"workspaceFolder": "/home/vscode/workspaces/androiddagashi.github.io",
11+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/workspaces/androiddagashi.github.io,type=bind,consistency=cached",
12+
"mounts": [
13+
{
14+
"source": "gh-config-${localWorkspaceFolderBasename}",
15+
"target": "/home/vscode/.config/gh",
16+
"type": "volume"
17+
},
18+
{
19+
"source": "claude-code-config-${localWorkspaceFolderBasename}",
20+
"target": "/home/vscode/.claude",
21+
"type": "volume"
22+
},
23+
{
24+
"source": "codex-config-${localWorkspaceFolderBasename}",
25+
"target": "/home/vscode/.codex",
26+
"type": "volume"
27+
},
28+
{
29+
"source": "github-copilot-cli-config-${localWorkspaceFolderBasename}",
30+
"target": "/home/vscode/.copilot",
31+
"type": "volume"
32+
}
33+
],
34+
"features": {
35+
"ghcr.io/devcontainers/features/github-cli:1": {
36+
"installDirectlyFromGitHubRelease": true,
37+
"version": "latest"
38+
},
39+
"ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {}
40+
},
41+
"onCreateCommand": [
42+
"/bin/bash", "/home/vscode/workspaces/androiddagashi.github.io/.devcontainer/scripts/on-create.sh"
43+
]
44+
}

0 commit comments

Comments
 (0)