|
1 | | -# Windows環境でのDockerを使用したLinuxビルド |
| 1 | +# Linux Build with Docker on Windows |
2 | 2 |
|
3 | | -このガイドでは、Windows環境からDockerを使用してLinux向けのビルドを行う方法を説明します。 |
| 3 | +This guide explains how to build Linux packages from Windows using Docker. |
4 | 4 |
|
5 | | -## 前提条件 |
| 5 | +## Prerequisites |
6 | 6 |
|
7 | | -### 1. Docker Desktopのインストール |
| 7 | +- Windows 10/11 (64-bit) |
| 8 | +- Docker Desktop (WSL 2 backend recommended) |
| 9 | +- PowerShell 5.1+ |
| 10 | +- At least 8 GB RAM (16 GB recommended) |
| 11 | +- At least 20 GB free disk space |
8 | 12 |
|
9 | | -1. [Docker Desktop for Windows](https://www.docker.com/products/docker-desktop/) をダウンロードしてインストール |
10 | | -2. Docker Desktopを起動し、完全に起動するまで待つ |
11 | | -3. 設定で「Use WSL 2 based engine」が有効になっていることを確認(推奨) |
| 13 | +## Build Commands |
12 | 14 |
|
13 | | -### 2. システム要件 |
14 | | - |
15 | | -- **Windows 10/11** (64-bit) |
16 | | -- **WSL 2** (推奨) |
17 | | -- **メモリ**: 最低 8GB RAM (16GB推奨) |
18 | | -- **ディスク空き容量**: 最低 20GB |
19 | | - |
20 | | -### 3. PowerShellの要件 |
21 | | - |
22 | | -PowerShell 5.1以上が必要です(Windows 10/11には標準搭載) |
23 | | - |
24 | | -```powershell |
25 | | -# PowerShellのバージョン確認 |
26 | | -$PSVersionTable.PSVersion |
27 | | -``` |
28 | | - |
29 | | -## ビルド方法 |
30 | | - |
31 | | -### 基本的なビルド |
32 | | - |
33 | | -プロジェクトルートから以下のコマンドを実行: |
| 15 | +From the project root: |
34 | 16 |
|
35 | 17 | ```powershell |
36 | | -# x86_64 (AMD64) Linux用 |
37 | 18 | pnpm run build:tauri:linux-x64 |
38 | | -
|
39 | | -# ARM64 Linux用 |
40 | 19 | pnpm run build:tauri:linux-arm64 |
41 | 20 | ``` |
42 | 21 |
|
43 | | -または、直接スクリプトを実行: |
| 22 | +Or run the script directly: |
44 | 23 |
|
45 | 24 | ```powershell |
46 | | -# x86_64ビルド |
47 | 25 | pwsh .\scripts\build-linux-docker.ps1 -Target x64 |
48 | | -
|
49 | | -# ARM64ビルド |
50 | 26 | pwsh .\scripts\build-linux-docker.ps1 -Target arm64 |
51 | 27 | ``` |
52 | 28 |
|
53 | | -### AppImageを含めたビルド |
54 | | - |
55 | | -デフォルトでは `.deb` と `.rpm` のみが生成されます。AppImageも生成したい場合: |
| 29 | +Build with AppImage: |
56 | 30 |
|
57 | 31 | ```powershell |
58 | 32 | pwsh .\scripts\build-linux-docker.ps1 -Target x64 -IncludeAppImage |
59 | 33 | ``` |
60 | 34 |
|
61 | | -> **注意**: AppImageのビルドにはFUSEが必要で、Docker環境では制限があります。 |
62 | | -
|
63 | | -## ビルド設定のカスタマイズ |
64 | | - |
65 | | -`.env` ファイルでビルド設定をカスタマイズできます: |
| 35 | +## Build Settings (.env) |
66 | 36 |
|
67 | 37 | ```bash |
68 | | -# Docker Build Settings |
69 | | -BUILD_CPUS=4 # 使用するCPUコア数 |
70 | | -BUILD_MEMORY=8g # メモリ制限 |
71 | | -CARGO_BUILD_JOBS=4 # Cargoの並列ジョブ数 |
72 | | -MAKEFLAGS=-j4 # Makeの並列度 |
73 | | -INCLUDE_APPIMAGE=false # AppImageを含めるか |
| 38 | +BUILD_CPUS=4 |
| 39 | +BUILD_MEMORY=8g |
| 40 | +CARGO_BUILD_JOBS=4 |
| 41 | +MAKEFLAGS=-j4 |
| 42 | +INCLUDE_APPIMAGE=false |
74 | 43 | ``` |
75 | 44 |
|
76 | | -## ビルド成果物 |
| 45 | +## Output Artifacts |
77 | 46 |
|
78 | | -ビルドが完了すると、以下の場所に成果物が生成されます: |
79 | | - |
80 | | -``` |
| 47 | +```text |
81 | 48 | app/src-tauri/target/<target>/release/bundle/ |
82 | | -├── deb/ |
83 | | -│ └── drop-compress-image_<version>_<arch>.deb |
84 | | -└── rpm/ |
85 | | - └── drop-compress-image-<version>-1.<arch>.rpm |
86 | 49 | ``` |
87 | 50 |
|
88 | | -例: |
| 51 | +- `.deb` |
| 52 | +- `.rpm` |
| 53 | +- `.AppImage` (optional) |
89 | 54 |
|
90 | | -- `app/src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/` |
91 | | -- `app/src-tauri/target/aarch64-unknown-linux-gnu/release/bundle/deb/` |
| 55 | +## Troubleshooting |
92 | 56 |
|
93 | | -## トラブルシューティング |
| 57 | +### Docker Desktop is not running |
94 | 58 |
|
95 | | -### Docker Desktopが起動していない |
| 59 | +Start Docker Desktop and try again. |
96 | 60 |
|
97 | | -``` |
98 | | -❌ エラー: Docker Desktop が起動していません。 |
99 | | -``` |
100 | | - |
101 | | -**解決方法**: Docker Desktopを起動してから、再度実行してください。 |
102 | | - |
103 | | -### メモリ不足エラー |
104 | | - |
105 | | -``` |
106 | | -error: linking with `cc` failed: exit status: 1 |
107 | | -``` |
108 | | - |
109 | | -**解決方法**: `.env`ファイルでメモリ制限を増やす、またはDocker Desktopの設定でメモリを増やします: |
110 | | - |
111 | | -1. Docker Desktop → Settings → Resources → Memory |
112 | | -2. メモリスライダーを増やす(推奨: 8GB以上) |
113 | | -3. Apply & Restartをクリック |
114 | | - |
115 | | -### ビルドが遅い |
| 61 | +### Out of memory |
116 | 62 |
|
117 | | -**解決方法**: CPUコア数とメモリを増やす |
| 63 | +Increase Docker memory or `BUILD_MEMORY` in `.env`. |
118 | 64 |
|
119 | | -```bash |
120 | | -# .envファイルに追加 |
121 | | -BUILD_CPUS=8 |
122 | | -BUILD_MEMORY=16g |
123 | | -CARGO_BUILD_JOBS=8 |
124 | | -``` |
125 | | - |
126 | | -### WSL 2バックエンドが無効 |
127 | | - |
128 | | -**解決方法**: |
129 | | - |
130 | | -1. Docker Desktop → Settings → General |
131 | | -2. "Use the WSL 2 based engine"にチェック |
132 | | -3. Apply & Restart |
| 65 | +### Slow builds |
133 | 66 |
|
134 | | -### ビルドキャッシュをクリアしたい |
| 67 | +Increase CPU/memory, and keep Docker cache volumes. |
135 | 68 |
|
136 | | -Dockerボリュームを削除: |
| 69 | +## References |
137 | 70 |
|
138 | | -```powershell |
139 | | -docker volume rm dropwebp-cargo-cache-linux-amd64 |
140 | | -docker volume rm dropwebp-pnpm-cache-linux-amd64 |
141 | | -docker volume rm dropwebp-target-cache-linux-amd64 |
142 | | -``` |
143 | | - |
144 | | -ARM64の場合: |
145 | | - |
146 | | -```powershell |
147 | | -docker volume rm dropwebp-cargo-cache-linux-arm64 |
148 | | -docker volume rm dropwebp-pnpm-cache-linux-arm64 |
149 | | -docker volume rm dropwebp-target-cache-linux-arm64 |
150 | | -``` |
151 | | - |
152 | | -## 高度な使用方法 |
153 | | - |
154 | | -### クロスプラットフォームビルド |
155 | | - |
156 | | -Windows環境から両方のアーキテクチャをビルド: |
157 | | - |
158 | | -```powershell |
159 | | -# x86_64とARM64の両方をビルド |
160 | | -pnpm run build:tauri:linux-x64 |
161 | | -pnpm run build:tauri:linux-arm64 |
162 | | -``` |
163 | | - |
164 | | -### カスタムDockerfile |
165 | | - |
166 | | -独自のDockerfileを使用する場合: |
167 | | - |
168 | | -```powershell |
169 | | -docker build -f YourDockerfile.linux-x64 -t your-builder . |
170 | | -``` |
171 | | - |
172 | | -### デバッグモード |
173 | | - |
174 | | -詳細なログ出力を有効にする: |
175 | | - |
176 | | -```powershell |
177 | | -$env:VERBOSE = "1" |
178 | | -pwsh .\scripts\build-linux-docker.ps1 -Target x64 |
179 | | -``` |
180 | | - |
181 | | -## パフォーマンス最適化 |
182 | | - |
183 | | -### 推奨設定(高性能PC) |
184 | | - |
185 | | -```bash |
186 | | -# .envファイル |
187 | | -BUILD_CPUS=12 |
188 | | -BUILD_MEMORY=16g |
189 | | -CARGO_BUILD_JOBS=12 |
190 | | -MAKEFLAGS=-j12 |
191 | | -``` |
192 | | - |
193 | | -### 推奨設定(一般的なPC) |
194 | | - |
195 | | -```bash |
196 | | -# .envファイル |
197 | | -BUILD_CPUS=4 |
198 | | -BUILD_MEMORY=8g |
199 | | -CARGO_BUILD_JOBS=4 |
200 | | -MAKEFLAGS=-j4 |
201 | | -``` |
202 | | - |
203 | | -## 参考資料 |
204 | | - |
205 | | -- [Docker Desktop for Windows](https://docs.docker.com/desktop/windows/) |
206 | | -- [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/install) |
| 71 | +- [docker-build.md](docker-build.md) |
207 | 72 | - [Tauri Documentation](https://tauri.app/v1/guides/building/) |
208 | | - |
209 | | -## 関連ドキュメント |
210 | | - |
211 | | -- [DOCKER_BUILD.md](docker-build.md) - macOS/Linuxでのビルド手順 |
212 | | -- [WINDOWS_BUILD_VCPKG.md](./WINDOWS_BUILD_VCPKG.md) - Windowsネイティブビルド |
213 | | -- [MACOS_COMPATIBILITY.md](./MACOS_COMPATIBILITY.md) - macOS互換性情報 |
| 73 | +- [Docker Desktop for Windows](https://docs.docker.com/desktop/windows/) |
0 commit comments