質問編集履歴
1
Dockerfileとdocker-compose.ymlの内容を追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -151,4 +151,70 @@
|
|
151
151
|
mysqlのイメージを追加すべき?またはdocker-compose.ymlにまとめて記述されているので追加は不要?
|
152
152
|
|
153
153
|
### 補足
|
154
|
+
Dockerfileとdocker-compose.ymlの内容は以下の通りです。
|
155
|
+
|
156
|
+
Dockerfile
|
157
|
+
```
|
158
|
+
FROM php:8.1-fpm
|
159
|
+
|
160
|
+
COPY php.ini /usr/local/etc/php/
|
161
|
+
|
162
|
+
RUN apt update \
|
163
|
+
&& apt install -y default-mysql-client zlib1g-dev libzip-dev unzip libpng-dev libjpeg-dev \
|
164
|
+
&& docker-php-ext-configure gd --with-jpeg \
|
165
|
+
&& docker-php-ext-install pdo_mysql zip gd
|
166
|
+
|
167
|
+
RUN curl -sS https://getcomposer.org/installer | php \
|
168
|
+
&& mv composer.phar /usr/local/bin/composer \
|
169
|
+
&& composer self-update
|
170
|
+
|
171
|
+
WORKDIR /var/www
|
172
|
+
```
|
173
|
+
|
174
|
+
docker-compose.yml
|
175
|
+
```
|
176
|
+
version: '3.8'
|
177
|
+
|
178
|
+
services:
|
179
|
+
nginx:
|
180
|
+
image: nginx:1.21.1
|
181
|
+
ports:
|
182
|
+
- "80:80"
|
183
|
+
volumes:
|
184
|
+
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
|
185
|
+
- ./src:/var/www/
|
186
|
+
depends_on:
|
187
|
+
- php
|
188
|
+
|
154
|
-
|
189
|
+
php:
|
190
|
+
build: ./docker/php
|
191
|
+
volumes:
|
192
|
+
- ./src:/var/www/
|
193
|
+
|
194
|
+
mysql:
|
195
|
+
image: mysql:8.0.26
|
196
|
+
environment:
|
197
|
+
MYSQL_ROOT_PASSWORD: root
|
198
|
+
MYSQL_DATABASE: laravel_db
|
199
|
+
MYSQL_USER: laravel_user
|
200
|
+
MYSQL_PASSWORD: laravel_pass
|
201
|
+
command:
|
202
|
+
mysqld --default-authentication-plugin=mysql_native_password
|
203
|
+
volumes:
|
204
|
+
- ./docker/mysql/data:/var/lib/mysql
|
205
|
+
- ./docker/mysql/my.cnf:/etc/mysql/conf.d/my.cnf
|
206
|
+
platform: linux/amd64
|
207
|
+
|
208
|
+
phpmyadmin:
|
209
|
+
image: phpmyadmin/phpmyadmin
|
210
|
+
environment:
|
211
|
+
- PMA_ARBITRARY=1
|
212
|
+
- PMA_HOST=mysql
|
213
|
+
- PMA_USER=laravel_user
|
214
|
+
- PMA_PASSWORD=laravel_pass
|
215
|
+
depends_on:
|
216
|
+
- mysql
|
217
|
+
ports:
|
218
|
+
- 8080:80
|
219
|
+
platform: linux/amd64
|
220
|
+
```
|