質問編集履歴
1
Dockerfile、docker-compose.ymlnaなども追記。
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
circleCIにてbundler: command not found
|
1
|
+
circleCIにて"bundle exec rspec" => "bundler: command not found"
|
test
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
circleci/config.yml↓
|
23
|
+
#### circleci/config.yml↓
|
24
24
|
|
25
25
|
```
|
26
26
|
|
@@ -186,6 +186,120 @@
|
|
186
186
|
|
187
187
|
|
188
188
|
|
189
|
+
#### Dockerfile↓
|
190
|
+
|
191
|
+
```
|
192
|
+
|
193
|
+
FROM ruby:2.7
|
194
|
+
|
195
|
+
ENV RAILS_ENV=production
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
|
200
|
+
|
201
|
+
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
|
202
|
+
|
203
|
+
&& apt-get update -qq \
|
204
|
+
|
205
|
+
&& apt-get install -y nodejs yarn build-essential default-mysql-client
|
206
|
+
|
207
|
+
WORKDIR /app
|
208
|
+
|
209
|
+
COPY ./src /app
|
210
|
+
|
211
|
+
RUN bundle config --local set path 'vendor/bundle' \
|
212
|
+
|
213
|
+
&& bundle install
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
COPY start.sh /start.sh
|
218
|
+
|
219
|
+
RUN chmod 744 /start.sh
|
220
|
+
|
221
|
+
CMD [ "sh", "/start.sh" ]
|
222
|
+
|
223
|
+
```
|
224
|
+
|
225
|
+
#### start.sh↓
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
```ここに言語を入力
|
230
|
+
|
231
|
+
#! /bin/sh
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
if [ "${RAILS_ENV}" = "production" ]
|
236
|
+
|
237
|
+
then
|
238
|
+
|
239
|
+
bundle exec rails assets:precompile
|
240
|
+
|
241
|
+
fi
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
bundle exec rails s -p ${PORT:-3000} -b 0.0.0.0
|
246
|
+
|
247
|
+
```
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
#### docker-compose.yml↓
|
252
|
+
|
253
|
+
```
|
254
|
+
|
255
|
+
version: '3'
|
256
|
+
|
257
|
+
services:
|
258
|
+
|
259
|
+
db:
|
260
|
+
|
261
|
+
image: mysql:8.0
|
262
|
+
|
263
|
+
command: --default-authentication-plugin=mysql_native_password
|
264
|
+
|
265
|
+
volumes:
|
266
|
+
|
267
|
+
# - ./src/db/mysql_data:/var/lib/mysql
|
268
|
+
|
269
|
+
- mysql_data:/var/lib/mysql
|
270
|
+
|
271
|
+
environment:
|
272
|
+
|
273
|
+
MYSQL_ROOT_PASSWORD: password
|
274
|
+
|
275
|
+
MYSQL_USER: root
|
276
|
+
|
277
|
+
web:
|
278
|
+
|
279
|
+
build: .
|
280
|
+
|
281
|
+
command: bundle exec rails s -p 3000 -b '0.0.0.0'
|
282
|
+
|
283
|
+
volumes:
|
284
|
+
|
285
|
+
- ./src:/app
|
286
|
+
|
287
|
+
ports:
|
288
|
+
|
289
|
+
- "3000:3000"
|
290
|
+
|
291
|
+
depends_on:
|
292
|
+
|
293
|
+
- db
|
294
|
+
|
295
|
+
volumes:
|
296
|
+
|
297
|
+
mysql_data:
|
298
|
+
|
299
|
+
```
|
300
|
+
|
301
|
+
|
302
|
+
|
189
303
|
circleCI実行結果↓
|
190
304
|
|
191
305
|
testジョブの最後でerrorとなります。
|