-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
150 lines (124 loc) · 5.16 KB
/
Dockerfile.dev
File metadata and controls
150 lines (124 loc) · 5.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
FROM debian:trixie
ARG USER_ID=1000
ARG GROUP_ID=1000
ARG USERNAME=developer
# --- システムパッケージ ---
RUN <<EOF
apt update
apt dist-upgrade -yq
PACKAGES=$(cat <<'PKGLIST' | sed 's/#.*//'
build-essential
ca-certificates # HTTPS接続に必要
curl
file # Shrineによる画像アップロードに必要 (Rails)
fzf # Claude Codeで使用
git
gnupg # PostgreSQLのGPGキーとaptリポジトリに必要
imagemagick # Shrineによる画像アップロードに必要 (Rails)
jq # Claude Codeで使用
libffi-dev # Ruby拡張のビルドに必要
libglib2.0-0 # libvipsの依存パッケージ (Rails)
libreadline-dev # Rubyのreadline拡張に必要
libssl-dev # SSL関連のビルドに必要
libvips42 # 画像処理ライブラリ (Rails)
libyaml-dev # psych gemのインストールに必要 (Rails)
lsb-release # PostgreSQLのaptリポジトリ設定に必要
nano # Claude Codeで使用
net-tools # netstat (ネットワークデバッグ用)
psmisc # fuser (プロセス特定用)
ripgrep # Claude Codeで使用
sudo
tree # Claude Codeで使用
unzip
vim # Claude Codeで使用
zlib1g-dev # Rubyのzlib拡張に必要 (gem installに必須)
zsh
PKGLIST
)
apt install -y --no-install-recommends $PACKAGES
rm -rf /var/lib/apt/lists/*
EOF
# --- PostgreSQL クライアント ---
RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg && \
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
> /etc/apt/sources.list.d/pgdg.list && \
apt update && apt install -y libpq-dev postgresql-client-18 && \
rm -rf /var/lib/apt/lists/*
# --- mise (開発ツールバージョンマネージャー) ---
# Docker環境向けの推奨設定: shims方式を使用
ENV MISE_DATA_DIR="/mise"
ENV MISE_CONFIG_DIR="/mise"
ENV MISE_CACHE_DIR="/mise/cache"
ENV MISE_INSTALL_PATH="/usr/local/bin/mise"
ENV PATH="/mise/shims:${PATH}"
RUN curl https://mise.run | sh
# Go、Ruby、Node.js、pnpmをmise経由でインストール
RUN mise install go@1.25.5 && \
mise install ruby@3.4.4 && \
mise install node@24.13.0 && \
mise install node@20.16.0 && \
mise install pnpm@10.25.0 && \
mise install pnpm@10.12.3
# グローバルデフォルトを設定
RUN mise use --global go@1.25.5 && \
mise use --global ruby@3.4.4 && \
mise use --global node@24.13.0 && \
mise use --global pnpm@10.25.0
# --- dbmate ---
RUN curl -fsSL -o /usr/local/bin/dbmate \
https://github.com/amacneil/dbmate/releases/latest/download/dbmate-linux-amd64 && \
chmod +x /usr/local/bin/dbmate
# --- hivemind ---
RUN curl -fsSL -L -o /tmp/hivemind.gz \
https://github.com/DarthSim/hivemind/releases/download/v1.1.0/hivemind-v1.1.0-linux-amd64.gz && \
gunzip /tmp/hivemind.gz && \
mv /tmp/hivemind /usr/local/bin/hivemind && \
chmod +x /usr/local/bin/hivemind
# --- golangci-lint ---
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh \
| sh -s -- -b /usr/local/bin v2.7.2
# --- ユーザー作成 ---
RUN groupadd -g ${GROUP_ID} ${USERNAME} && \
useradd -u ${USER_ID} -g ${GROUP_ID} -m -s /bin/zsh ${USERNAME} && \
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# --- Go キャッシュディレクトリ ---
RUN mkdir -p /go/.cache/go-build /go/pkg && \
chown -R ${USER_ID}:${GROUP_ID} /go
# --- mise のデータディレクトリの権限設定 ---
RUN chown -R ${USER_ID}:${GROUP_ID} /mise
WORKDIR /workspace
USER ${USERNAME}
# --- .zshrc の作成 ---
RUN touch ~/.zshrc
# --- mise シェル設定 ---
# Docker環境ではshims方式を使用(PATH="/mise/shims:..."で設定済み)
# mise activateはshimsをバイパスしてグローバルデフォルトの直接パスをPATHに追加するため、
# ディレクトリごとのバージョン切り替えが効かなくなる。shims方式では不要。
RUN mise reshim
# --- 1Password CLI ---
COPY --from=1password/op:2 /usr/local/bin/op /usr/local/bin/op
# --- Fresh Editor ---
RUN curl -fsSL -L -o /tmp/fresh-editor.deb \
https://github.com/sinelaw/fresh/releases/download/v0.2.12/fresh-editor_0.2.12-1_amd64.deb && \
dpkg -i /tmp/fresh-editor.deb && \
rm /tmp/fresh-editor.deb
# --- Claude Code ---
RUN curl -fsSL https://claude.ai/install.sh | bash
# --- Go ツール ---
ENV GOCACHE=/go/.cache/go-build
ENV GOMODCACHE=/go/pkg/mod
ENV GOPATH=/go
ENV PATH="${GOPATH}/bin:${PATH}"
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.30.0 && \
go install github.com/air-verse/air@latest
# --- Ruby ツール ---
RUN gem install bundler -v 2.5.16
# --- シェル設定 ---
SHELL ["/bin/zsh", "-c"]
ENV SHELL=/bin/zsh
# --- Git設定 ---
RUN git config --global user.email "me@shimba.co" && \
git config --global user.name "Koji Shimba"
EXPOSE 8080 3000
CMD ["/bin/zsh"]