2017-08-25 71 views
0

我正在使用rails 5.0.1與gem'ckeditor',github:'galetahub/ckeditor'。Rails ckeditor僅在本地上傳圖像,而不是在docker

本地運行,當我把它上傳作品圖片:

Started POST "/ckeditor/pictures?CKEditor=blog_content&CKEditorFuncNum=1&langCode=en" for 127.0.0.1 at 2017-08-25 13:42:46 +0200 
Processing by Ckeditor::PicturesController#create as HTML 
    Parameters: {"upload"=>#<ActionDispatch::Http::UploadedFile:0x007fdbb2751418 @tempfile=#<Tempfile:/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/RackMultipart20170825-15213-h6z3o4.jpg>, @original_filename="Celina.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"upload\"; filename=\"Celina.jpg\"\r\nContent-Type: image/jpeg\r\n">, "ckCsrfToken"=>"KWW95qRoTkkliU37ytqWhxGEg0Qmlo2BlMa3jhY0", "CKEditor"=>"blog_content", "CKEditorFuncNum"=>"1", "langCode"=>"en"} 
Command :: PATH=/usr/bin/:$PATH; identify -format '%wx%h,%[exif:orientation]' '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' 2>/dev/null 
Command :: PATH=/usr/bin/:$PATH; identify -format %m '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' 
Command :: PATH=/usr/bin/:$PATH; convert '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' -auto-orient -resize "800>" '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/81df6ad10e023d4b1d778924afca264320170825-15213-191pjjb' 
Command :: PATH=/usr/bin/:$PATH; identify -format '%wx%h,%[exif:orientation]' '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' 2>/dev/null 
Command :: PATH=/usr/bin/:$PATH; identify -format %m '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' 
Command :: PATH=/usr/bin/:$PATH; convert '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' -auto-orient -resize "x100" -crop "118x100+8+0" +repage '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/81df6ad10e023d4b1d778924afca264320170825-15213-4zjjfu' 
    (0.4ms) BEGIN 
Command :: PATH=/usr/bin/:$PATH; identify -format '%wx%h,%[exif:orientation]' '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' 2>/dev/null 
    SQL (1.0ms) INSERT INTO "ckeditor_assets" ("data_file_name", "data_content_type", "data_file_size", "data_fingerprint", "type", "width", "height", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["data_file_name", "Celina.jpg"], ["data_content_type", "image/jpeg"], ["data_file_size", 20803], ["data_fingerprint", "64cabe13eace3919caf99ca7fc5ce98a"], ["type", "Ckeditor::Picture"], ["width", 300], ["height", 223], ["created_at", "2017-08-25 11:42:46.485116"], ["updated_at", "2017-08-25 11:42:46.485116"]] 
    (0.4ms) COMMIT 
    Rendering html template 
    Rendered html template (0.0ms) 
Completed 200 OK in 212ms (Views: 2.4ms | ActiveRecord: 5.6ms) 

但是當我在泊塢窗運行該項目在不改變任何東西它給我的錯誤信息:數據內容類型無效

web_1 | Started POST "/ckeditor/pictures?CKEditor=blog_content&CKEditorFuncNum=1&langCode=en" for xxx.xx.x.x at 2017-08-25 12:43:29 +0000 
web_1 | Processing by Ckeditor::PicturesController#create as HTML 
web_1 | Parameters: {"upload"=>#<ActionDispatch::Http::UploadedFile:0x000033deb977a8 @tempfile=#<Tempfile:/tmp/RackMultipart20170825-1-26b8ip.jpg>, @original_filename="Celina.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"upload\"; filename=\"Celina.jpg\"\r\nContent-Type: image/jpeg\r\n">, "ckCsrfToken"=>"KWW95qRoTkkliU37ytqWhxGEg0Qmlo2BlMa3jhY0", "CKEditor"=>"blog_content", "CKEditorFuncNum"=>"1", "langCode"=>"en"} 
web_1 | Command :: PATH=/usr/bin/:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]' 2>/dev/null 
web_1 | Command :: PATH=/usr/bin/:$PATH; identify -format %m '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]' 
web_1 | Command :: PATH=/usr/bin/:$PATH; convert '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]' -auto-orient -resize "800>" '/tmp/fdc33e93e3e5f5ae6778f9e43bf8b70620170825-1-wddlyh' 
web_1 | Command :: PATH=/usr/bin/:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]' 2>/dev/null 
web_1 | Command :: PATH=/usr/bin/:$PATH; identify -format %m '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]' 
web_1 | Command :: PATH=/usr/bin/:$PATH; convert '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]' -auto-orient -resize "x100" -crop "118x100+8+0" +repage '/tmp/fdc33e93e3e5f5ae6778f9e43bf8b70620170825-1-sf9kaf' 
web_1 | (0.2ms) BEGIN 
web_1 | (0.2ms) ROLLBACK 
web_1 | Rendering html template 
web_1 | Rendered html template (0.0ms) 
web_1 | Completed 200 OK in 259ms (Views: 8.9ms | ActiveRecord: 28.6ms) 

任何想法?由於

[編輯]

Dockerfile

紅寶石:2.3.3高山

ENV RAILS_ENV production 
ENV RACK_ENV production 

# Install dependencies 
RUN apk update && \ 
    apk upgrade && \ 
    apk add --update --no-cache \ 
     build-base \ 
     imagemagick \ 
     bash \ 
     git \ 
     nodejs \ 
     tzdata \ 
     libxml2-dev \ 
     libxslt-dev \ 
     postgresql-dev \ 
    && rm -rf /var/cache/apk/* \ 
    && bundle config build.nokogiri --use-system-libraries \ 
    && gem install bundler --no-ri --no-rdoc \ 
    && mkdir -p /usr/src/i2i 

WORKDIR /usr/src/i2i 
COPY Gemfile Gemfile 
COPY Gemfile.lock Gemfile.lock 
RUN bundle install --jobs 20 --retry 5 --without development test 
ADD . /usr/src/i2i 

# Precompile Rails assets 
RUN bundle exec rake assets:precompile 
+0

你Dockerfile安裝它們? –

+0

在docker中複製圖像並手動執行這些命令,看看是否可以看到正在執行的命令中有任何錯誤? –

+0

@TarunLalwani將dockerfile添加到帖子中,謝謝。 – Ivanyk

回答

1

而不是ruby:2.3.3-alpine你能嘗試使用ruby:2.3.3-jessie

問題是,某些命令可能需要一些先決條件包,而阿爾卑斯是一個非常小的圖像,包可能不存在。

因此,無論您可以繼續使用更大和更豐富的資源像像ruby:2.3.3-jessie或者你可以找到的依賴和ruby:2.3.3-alpine

相關問題