質問編集履歴
1
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
|
5
5
|
### 前提・実現したいこと
|
6
6
|
|
7
|
-
dockerで環境構築をしたい。
|
7
|
+
dockerで環境構築をしたいです。
|
8
8
|
|
9
9
|
|
10
10
|
|
11
11
|
### 発生している問題・エラーメッセージ
|
12
12
|
|
13
|
-
|
13
|
+
make create-projectを実行したときにエラーが発生します。
|
14
14
|
|
15
15
|
```
|
16
16
|
|
@@ -28,11 +28,425 @@
|
|
28
28
|
|
29
29
|
```
|
30
30
|
|
31
|
-
|
31
|
+
docker-compose.yml
|
32
|
+
|
32
|
-
|
33
|
+
```
|
34
|
+
|
33
|
-
|
35
|
+
version: "3.9"
|
36
|
+
|
34
|
-
|
37
|
+
volumes:
|
38
|
+
|
35
|
-
|
39
|
+
php-fpm-socket:
|
40
|
+
|
41
|
+
db-store:
|
42
|
+
|
43
|
+
psysh-store:
|
44
|
+
|
45
|
+
services:
|
46
|
+
|
47
|
+
app:
|
48
|
+
|
49
|
+
build:
|
50
|
+
|
51
|
+
context: .
|
52
|
+
|
53
|
+
dockerfile: ./infra/docker/php/Dockerfile
|
54
|
+
|
55
|
+
volumes:
|
56
|
+
|
57
|
+
- type: volume
|
58
|
+
|
59
|
+
source: php-fpm-socket
|
60
|
+
|
61
|
+
target: /var/run/php-fpm
|
62
|
+
|
63
|
+
volume:
|
64
|
+
|
65
|
+
nocopy: true
|
66
|
+
|
67
|
+
- type: bind
|
68
|
+
|
69
|
+
source: ./backend
|
70
|
+
|
71
|
+
target: /work/backend
|
72
|
+
|
73
|
+
- type: volume
|
74
|
+
|
75
|
+
source: psysh-store
|
76
|
+
|
77
|
+
target: /root/.config/psysh
|
78
|
+
|
79
|
+
volume:
|
80
|
+
|
81
|
+
nocopy: true
|
82
|
+
|
83
|
+
environment:
|
84
|
+
|
85
|
+
- DB_CONNECTION=mysql
|
86
|
+
|
87
|
+
- DB_HOST=db
|
88
|
+
|
89
|
+
- DB_PORT=3306
|
90
|
+
|
91
|
+
- DB_DATABASE=${DB_NAME:-laravel_local}
|
92
|
+
|
93
|
+
- DB_USERNAME=${DB_USER:-phper}
|
94
|
+
|
95
|
+
- DB_PASSWORD=${DB_PASS:-secret}
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
web:
|
100
|
+
|
101
|
+
build:
|
102
|
+
|
103
|
+
context: .
|
104
|
+
|
105
|
+
dockerfile: ./infra/docker/nginx/Dockerfile
|
106
|
+
|
107
|
+
ports:
|
108
|
+
|
109
|
+
- target: 80
|
110
|
+
|
111
|
+
published: ${WEB_PORT:-80}
|
112
|
+
|
113
|
+
protocol: tcp
|
114
|
+
|
115
|
+
mode: host
|
116
|
+
|
117
|
+
volumes:
|
118
|
+
|
119
|
+
- type: volume
|
120
|
+
|
121
|
+
source: php-fpm-socket
|
122
|
+
|
123
|
+
target: /var/run/php-fpm
|
124
|
+
|
125
|
+
volume:
|
126
|
+
|
127
|
+
nocopy: true
|
128
|
+
|
129
|
+
- type: bind
|
130
|
+
|
131
|
+
source: ./backend
|
132
|
+
|
133
|
+
target: /work/backend
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
db:
|
138
|
+
|
139
|
+
build:
|
140
|
+
|
141
|
+
context: .
|
142
|
+
|
143
|
+
dockerfile: ./infra/docker/mysql/Dockerfile
|
144
|
+
|
145
|
+
ports:
|
146
|
+
|
147
|
+
- target: 3306
|
148
|
+
|
149
|
+
published: ${DB_PORT:-3306}
|
150
|
+
|
151
|
+
protocol: tcp
|
152
|
+
|
153
|
+
mode: host
|
154
|
+
|
155
|
+
volumes:
|
156
|
+
|
157
|
+
- type: volume
|
158
|
+
|
159
|
+
source: db-store
|
160
|
+
|
161
|
+
target: /var/lib/mysql
|
162
|
+
|
163
|
+
volume:
|
164
|
+
|
165
|
+
nocopy: true
|
166
|
+
|
167
|
+
environment:
|
168
|
+
|
169
|
+
- MYSQL_DATABASE=${DB_NAME:-laravel_local}
|
170
|
+
|
171
|
+
- MYSQL_USER=${DB_USER:-phper}
|
172
|
+
|
173
|
+
- MYSQL_PASSWORD=${DB_PASS:-secret}
|
174
|
+
|
175
|
+
- MYSQL_ROOT_PASSWORD=${DB_PASS:-secret}
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
```
|
180
|
+
|
181
|
+
Makefile
|
182
|
+
|
183
|
+
```
|
184
|
+
|
185
|
+
up:
|
186
|
+
|
187
|
+
docker compose up -d
|
188
|
+
|
189
|
+
build:
|
190
|
+
|
191
|
+
docker compose build --no-cache --force-rm
|
192
|
+
|
193
|
+
laravel-install:
|
194
|
+
|
195
|
+
docker compose exec app composer create-project --prefer-dist "laravel/laravel=6.*" .
|
196
|
+
|
197
|
+
create-project:
|
198
|
+
|
199
|
+
mkdir -p backend
|
200
|
+
|
201
|
+
@make build
|
202
|
+
|
203
|
+
@make up
|
204
|
+
|
205
|
+
@make laravel-install
|
206
|
+
|
207
|
+
docker compose exec app php artisan key:generate
|
208
|
+
|
209
|
+
docker compose exec app php artisan storage:link
|
210
|
+
|
211
|
+
docker compose exec app chmod -R 777 storage bootstrap/cache
|
212
|
+
|
213
|
+
@make fresh
|
214
|
+
|
215
|
+
install-recommend-packages:
|
216
|
+
|
217
|
+
docker compose exec app composer require doctrine/dbal
|
218
|
+
|
219
|
+
docker compose exec app composer require --dev ucan-lab/laravel-dacapo
|
220
|
+
|
221
|
+
docker compose exec app composer require --dev barryvdh/laravel-ide-helper
|
222
|
+
|
223
|
+
docker compose exec app composer require --dev beyondcode/laravel-dump-server
|
224
|
+
|
225
|
+
docker compose exec app composer require --dev barryvdh/laravel-debugbar
|
226
|
+
|
227
|
+
docker compose exec app composer require --dev roave/security-advisories:dev-master
|
228
|
+
|
229
|
+
docker compose exec app php artisan vendor:publish --provider="BeyondCode\DumpServer\DumpServerServiceProvider"
|
230
|
+
|
231
|
+
docker compose exec app php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
|
232
|
+
|
233
|
+
init:
|
234
|
+
|
235
|
+
docker compose up -d --build
|
236
|
+
|
237
|
+
docker compose exec app composer install
|
238
|
+
|
239
|
+
docker compose exec app cp .env.example .env
|
240
|
+
|
241
|
+
docker compose exec app php artisan key:generate
|
242
|
+
|
243
|
+
docker compose exec app php artisan storage:link
|
244
|
+
|
245
|
+
docker compose exec app chmod -R 777 storage bootstrap/cache
|
246
|
+
|
247
|
+
@make fresh
|
248
|
+
|
249
|
+
remake:
|
250
|
+
|
251
|
+
@make destroy
|
252
|
+
|
253
|
+
@make init
|
254
|
+
|
255
|
+
stop:
|
256
|
+
|
257
|
+
docker compose stop
|
258
|
+
|
259
|
+
down:
|
260
|
+
|
261
|
+
docker compose down --remove-orphans
|
262
|
+
|
263
|
+
restart:
|
264
|
+
|
265
|
+
@make down
|
266
|
+
|
267
|
+
@make up
|
268
|
+
|
269
|
+
destroy:
|
270
|
+
|
271
|
+
docker compose down --rmi all --volumes --remove-orphans
|
272
|
+
|
273
|
+
destroy-volumes:
|
274
|
+
|
275
|
+
docker compose down --volumes --remove-orphans
|
276
|
+
|
277
|
+
ps:
|
278
|
+
|
279
|
+
docker compose ps
|
280
|
+
|
281
|
+
logs:
|
282
|
+
|
283
|
+
docker compose logs
|
284
|
+
|
285
|
+
logs-watch:
|
286
|
+
|
287
|
+
docker compose logs --follow
|
288
|
+
|
289
|
+
log-web:
|
290
|
+
|
291
|
+
docker compose logs web
|
292
|
+
|
293
|
+
log-web-watch:
|
294
|
+
|
295
|
+
docker compose logs --follow web
|
296
|
+
|
297
|
+
log-app:
|
298
|
+
|
299
|
+
docker compose logs app
|
300
|
+
|
301
|
+
log-app-watch:
|
302
|
+
|
303
|
+
docker compose logs --follow app
|
304
|
+
|
305
|
+
log-db:
|
306
|
+
|
307
|
+
docker compose logs db
|
308
|
+
|
309
|
+
log-db-watch:
|
310
|
+
|
311
|
+
docker compose logs --follow db
|
312
|
+
|
313
|
+
web:
|
314
|
+
|
315
|
+
docker compose exec web ash
|
316
|
+
|
317
|
+
app:
|
318
|
+
|
319
|
+
docker compose exec app bash
|
320
|
+
|
321
|
+
migrate:
|
322
|
+
|
323
|
+
docker compose exec app php artisan migrate
|
324
|
+
|
325
|
+
fresh:
|
326
|
+
|
327
|
+
docker compose exec app php artisan migrate:fresh --seed
|
328
|
+
|
329
|
+
seed:
|
330
|
+
|
331
|
+
docker compose exec app php artisan db:seed
|
332
|
+
|
333
|
+
dacapo:
|
334
|
+
|
335
|
+
docker compose exec app php artisan dacapo
|
336
|
+
|
337
|
+
rollback-test:
|
338
|
+
|
339
|
+
docker compose exec app php artisan migrate:fresh
|
340
|
+
|
341
|
+
docker compose exec app php artisan migrate:refresh
|
342
|
+
|
343
|
+
tinker:
|
344
|
+
|
345
|
+
docker compose exec app php artisan tinker
|
346
|
+
|
347
|
+
test:
|
348
|
+
|
349
|
+
docker compose exec app php artisan test
|
350
|
+
|
351
|
+
optimize:
|
352
|
+
|
353
|
+
docker compose exec app php artisan optimize
|
354
|
+
|
355
|
+
optimize-clear:
|
356
|
+
|
357
|
+
docker compose exec app php artisan optimize:clear
|
358
|
+
|
359
|
+
cache:
|
360
|
+
|
361
|
+
docker compose exec app composer dump-autoload -o
|
362
|
+
|
363
|
+
@make optimize
|
364
|
+
|
365
|
+
docker compose exec app php artisan event:cache
|
366
|
+
|
367
|
+
docker compose exec app php artisan view:cache
|
368
|
+
|
369
|
+
cache-clear:
|
370
|
+
|
371
|
+
docker compose exec app composer clear-cache
|
372
|
+
|
373
|
+
@make optimize-clear
|
374
|
+
|
375
|
+
docker compose exec app php artisan event:clear
|
376
|
+
|
377
|
+
npm:
|
378
|
+
|
379
|
+
@make npm-install
|
380
|
+
|
381
|
+
npm-install:
|
382
|
+
|
383
|
+
docker compose exec web npm install
|
384
|
+
|
385
|
+
npm-dev:
|
386
|
+
|
387
|
+
docker compose exec web npm run dev
|
388
|
+
|
389
|
+
npm-watch:
|
390
|
+
|
391
|
+
docker compose exec web npm run watch
|
392
|
+
|
393
|
+
npm-watch-poll:
|
394
|
+
|
395
|
+
docker compose exec web npm run watch-poll
|
396
|
+
|
397
|
+
npm-hot:
|
398
|
+
|
399
|
+
docker compose exec web npm run hot
|
400
|
+
|
401
|
+
yarn:
|
402
|
+
|
403
|
+
docker compose exec web yarn
|
404
|
+
|
405
|
+
yarn-install:
|
406
|
+
|
407
|
+
@make yarn
|
408
|
+
|
409
|
+
yarn-dev:
|
410
|
+
|
411
|
+
docker compose exec web yarn dev
|
412
|
+
|
413
|
+
yarn-watch:
|
414
|
+
|
415
|
+
docker compose exec web yarn watch
|
416
|
+
|
417
|
+
yarn-watch-poll:
|
418
|
+
|
419
|
+
docker compose exec web yarn watch-poll
|
420
|
+
|
421
|
+
yarn-hot:
|
422
|
+
|
423
|
+
docker compose exec web yarn hot
|
424
|
+
|
425
|
+
db:
|
426
|
+
|
427
|
+
docker compose exec db bash
|
428
|
+
|
429
|
+
sql:
|
430
|
+
|
431
|
+
docker compose exec db bash -c 'mysql -u $$MYSQL_USER -p$$MYSQL_PASSWORD $$MYSQL_DATABASE'
|
432
|
+
|
433
|
+
redis:
|
434
|
+
|
435
|
+
docker compose exec redis redis-cli
|
436
|
+
|
437
|
+
ide-helper:
|
438
|
+
|
439
|
+
docker compose exec app php artisan clear-compiled
|
440
|
+
|
441
|
+
docker compose exec app php artisan ide-helper:generate
|
442
|
+
|
443
|
+
docker compose exec app php artisan ide-helper:meta
|
444
|
+
|
445
|
+
docker compose exec app php artisan ide-helper:models --nowrite
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
```
|
36
450
|
|
37
451
|
|
38
452
|
|
@@ -42,4 +456,4 @@
|
|
42
456
|
|
43
457
|
|
44
458
|
|
45
|
-
何度かこのdocker環境で構築したことがあ
|
459
|
+
何度かこのdocker環境で構築したことがありましたが、今回はうまくいきませんでした。
|