2017-08-25 1 views
0

J'utilise les rails 5.0.1 avec la gemme 'ckeditor', github: 'galetahub/ckeditor'.Rails ckeditor télécharge l'image uniquement localement, pas dans le docker

exécutées localement quand je télécharge une image cela fonctionne:

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) 

Mais quand je lance le projet docker sans changer quoi que ce soit il me donne le message d'erreur: type de contenu de données est invalide.

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) 

Des idées? Merci

[EDIT]

Dockerfile

DE ruby: 2.3.3-alpine

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

Votre Dockerfile? –

+0

Copiez l'image dans le docker et exécutez ces commandes manuellement pour voir si des erreurs sont survenues dans les commandes en cours d'exécution. –

+0

@TarunLalwani a ajouté le dockerfile à la poste, merci. – Ivanyk

Répondre

1

Au lieu de ruby:2.3.3-alpine peut vous essayez d'utiliser ruby:2.3.3-jessie. Le problème est que certaines commandes peuvent nécessiter certains paquets pré-requis et que l'alpin étant une très petite image, les paquets peuvent ne pas être présents.

Donc, soit vous pouvez continuer à utiliser un plus grand et plus l'image de ressources comme ruby:2.3.3-jessie ou vous pouvez trouver les dépendances et les installer sur ruby:2.3.3-alpine