質問編集履歴

3

解決法をまとめた

2019/12/18 11:00

投稿

k-810
k-810

スコア192

test CHANGED
File without changes
test CHANGED
@@ -76,130 +76,6 @@
76
76
 
77
77
 
78
78
 
79
- ###### docker-compose.yml
80
-
81
-
82
-
83
- ```
84
-
85
- version: "3.6"
86
-
87
-
88
-
89
- services:
90
-
91
- db:
92
-
93
- image: mysql:5.7
94
-
95
- command: mysqld #--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
96
-
97
- environment:
98
-
99
- TZ: "Asia/Tokyo"
100
-
101
- MYSQL_ROOT_PASSWORD: root
102
-
103
- MYSQL_DATABASE: app_name_development
104
-
105
- MYSQL_USER: app_name
106
-
107
- MYSQL_PASSWORD: app_name
108
-
109
- volumes:
110
-
111
- - ./docker/db/multibyte.cnf:/etc/mysql/conf.d/multibyte.cnf
112
-
113
- ports:
114
-
115
- - "13306:3306"
116
-
117
-
118
-
119
- webpacker:
120
-
121
- build: .
122
-
123
- command: ./bin/webpack-dev-server
124
-
125
- # command: /bin/bash -c 'rm -rf public/packs || true && bin/webpack-dev-server'
126
-
127
- volumes:
128
-
129
- - .:/app
130
-
131
- - node_modules:/app/node_modules
132
-
133
- - bundle:/usr/local/bundle
134
-
135
- ports:
136
-
137
- - "3035:3035"
138
-
139
- environment:
140
-
141
- RAILS_ENV: "development"
142
-
143
- NODE_ENV: "development"
144
-
145
- WEBPACKER_DEV_SERVER_HOST: "0.0.0.0"
146
-
147
- WEBPACKER_DEV_SERVER_PUBLIC: "0.0.0.0:3035"
148
-
149
-
150
-
151
- web:
152
-
153
- build: .
154
-
155
- command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
156
-
157
- volumes:
158
-
159
- - .:/app
160
-
161
- - node_modules:/app/node_modules
162
-
163
- - bundle:/usr/local/bundle
164
-
165
- ports:
166
-
167
- - "3000:3000"
168
-
169
- environment:
170
-
171
- TZ: "Asia/Tokyo"
172
-
173
- RAILS_ENV: "development"
174
-
175
- DATABASE_URL: "mysql2://app_name:app_name@db"
176
-
177
- WEBPACKER_DEV_SERVER_HOST: "webpacker"
178
-
179
- WEBPACKER_DEV_SERVER_PUBLIC: "webpacker:3035"
180
-
181
- depends_on:
182
-
183
- - db
184
-
185
- - webpacker
186
-
187
- tty: true
188
-
189
- stdin_open: true
190
-
191
-
192
-
193
- volumes:
194
-
195
- mysql-data:
196
-
197
- bundle:
198
-
199
- node_modules:
200
-
201
- ```
202
-
203
79
 
204
80
 
205
81
  ### 追記
@@ -251,3 +127,83 @@
251
127
  ERROR: Service 'webpacker' failed to build: The command '/bin/sh -c wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && tar Jxvf ./ffmpeg-release-64bit-static.tar.xz && cp ./ffmpeg*64bit-static/ffmpeg /usr/local/bin/' returned a non-zero code: 2
252
128
 
253
129
  ```
130
+
131
+
132
+
133
+ ### 最終的なdockerfile(解決)
134
+
135
+
136
+
137
+ ```
138
+
139
+ FROM node:10.13.0 as node
140
+
141
+ FROM ruby:2.5.0
142
+
143
+
144
+
145
+ ENV ENTRYKIT_VERSION 0.4.0
146
+
147
+
148
+
149
+ RUN wget https://github.com/progrium/entrykit/releases/download/v${ENTRYKIT_VERSION}/entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz \
150
+
151
+ && tar -xvzf entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz \
152
+
153
+ && rm entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz \
154
+
155
+ && mv entrykit /bin/entrykit \
156
+
157
+ && chmod +x /bin/entrykit \
158
+
159
+ && entrykit --symlink
160
+
161
+
162
+
163
+ ENV YARN_VERSION 1.10.1
164
+
165
+
166
+
167
+ COPY --from=node /opt/yarn-v$YARN_VERSION /opt/yarn
168
+
169
+ COPY --from=node /usr/local/bin/node /usr/local/bin/
170
+
171
+
172
+
173
+ RUN ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
174
+
175
+ && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg
176
+
177
+
178
+
179
+ WORKDIR /app
180
+
181
+
182
+
183
+ RUN bundle config build.nokogiri --use-system-libraries
184
+
185
+
186
+
187
+ ENTRYPOINT [ \
188
+
189
+ "prehook", "bundle install -j3", "--", \
190
+
191
+ "prehook", "yarn install", "--"]
192
+
193
+
194
+
195
+ RUN apt-get update && apt-get install -y \
196
+
197
+ wget \
198
+
199
+ xz-utils
200
+
201
+
202
+
203
+ RUN cd /tmp && wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz \
204
+
205
+ && tar Jxvf ./ffmpeg-release-64bit-static.tar.xz \
206
+
207
+ && cp ./ffmpeg*64bit-static/ffmpeg /usr/local/bin/
208
+
209
+ ```

2

誤字

2019/12/18 11:00

投稿

k-810
k-810

スコア192

test CHANGED
File without changes
test CHANGED
@@ -220,7 +220,7 @@
220
220
 
221
221
 
222
222
 
223
- RUN wget http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz \
223
+ RUN wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz \
224
224
 
225
225
  && tar Jxvf ./ffmpeg-release-64bit-static.tar.xz \
226
226
 

1

追記

2019/12/16 06:43

投稿

k-810
k-810

スコア192

test CHANGED
File without changes
test CHANGED
@@ -199,3 +199,55 @@
199
199
  node_modules:
200
200
 
201
201
  ```
202
+
203
+
204
+
205
+ ### 追記
206
+
207
+ Dockerfileの最後に以下を追加しました
208
+
209
+ ```
210
+
211
+ RUN apt-get update && apt-get install -y \
212
+
213
+ wget \
214
+
215
+ xz-utils
216
+
217
+
218
+
219
+ WORKDIR /tmp
220
+
221
+
222
+
223
+ RUN wget http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz \
224
+
225
+ && tar Jxvf ./ffmpeg-release-64bit-static.tar.xz \
226
+
227
+ && cp ./ffmpeg*64bit-static/ffmpeg /usr/local/bin/
228
+
229
+
230
+
231
+ ```
232
+
233
+
234
+
235
+ その上で
236
+
237
+ $docker-compose build
238
+
239
+ すると以下のエラーが発生しました
240
+
241
+ ```
242
+
243
+ tar (child): ./ffmpeg-release-64bit-static.tar.xz: Cannot open: No such file or directory
244
+
245
+ tar (child): Error is not recoverable: exiting now
246
+
247
+ tar: Child returned status 2
248
+
249
+ tar: Error is not recoverable: exiting now
250
+
251
+ ERROR: Service 'webpacker' failed to build: The command '/bin/sh -c wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && tar Jxvf ./ffmpeg-release-64bit-static.tar.xz && cp ./ffmpeg*64bit-static/ffmpeg /usr/local/bin/' returned a non-zero code: 2
252
+
253
+ ```