asilvas / node-image-steam

A simple, fast, and highly customizable on-the-fly image manipulation web server built atop Node.js
MIT License
170 stars 26 forks source link

Dockerfile? #69

Closed musicformellons closed 5 years ago

musicformellons commented 5 years ago

Do you have a dockerfile to build this in a container? OpenCV and Sharp seem tricky to get up in a container...

asilvas commented 5 years ago

No public dockerfile's, but feel free to use one of ours. We're not currently using OpenCV, which is optional.

FROM node:10.13.0-alpine as nodebase

RUN echo "http://dl-2.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories; \
    echo "http://dl-3.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories; \
    echo "http://dl-3.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories;

WORKDIR '/src'

FROM nodebase as build

RUN apk add --update build-base
RUN apk add python2

COPY . .

# OPENCV4NODEJS_DISABLE_AUTOBUILD=1 : Currently unused, but forced usage of pre-built binaries
# SHARP_IGNORE_GLOBAL_LIBVIPS=1 : Force to ignore global install (if any) and use pre-built binaries instead
# --build-from-source : Required by `farmhash` to force build instead of using pre-built binaries
# --verbose : Very useful for debugging exactly the compiler optimizations that are being supplied
RUN NODE_ENV=production OPENCV4NODEJS_DISABLE_AUTOBUILD=1 SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm i --no-optional --no-save --only=prod --build-from-source --verbose
# farmhash is a special case for now due to its dependency on modern instruction sets. But this will probably grow at some point
# CXXFLAGS="-mno-avx2 -mno-bmi2" : Required to lock down native builds to older instruction sets. Avoiding major conflicts between mixed hardware in GoDaddy OpenStack
RUN CXXFLAGS="-mno-avx2 -mno-bmi2" NODE_ENV=production npm rebuild farmhash --build-from-source --verbose

FROM nodebase as release

COPY --from=build /src/bin /src/bin
COPY --from=build /src/lib /src/lib
COPY --from=build /src/node_modules /src/node_modules
COPY --from=build /src/package.json /src/index.js /src/
musicformellons commented 5 years ago

When I download the repo, unzip it, and put above dockerfile in same folder and then build it run for a while and looks ok, but then I get error. Tried with Master and version 0.48.2, but get same error. This is the end of the log, when it starts to look 'shady':


> xxhash@0.2.4 install /src/node_modules/xxhash
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild' ]
gyp info using node-gyp@3.8.0
gyp info using node@10.13.0 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/bin/python2
gyp verb check python version `/usr/bin/python2 -c "import sys; print "2.7.15
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 10.13.0
gyp verb command install [ '10.13.0' ]
gyp verb install input version string "10.13.0"
gyp verb install installing version: 10.13.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 10.13.0
gyp verb build dir attempting to create "build" dir: /src/node_modules/xxhash/build
gyp verb build dir "build" dir needed to be created? /src/node_modules/xxhash/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /src/node_modules/xxhash/build/config.gypi
gyp verb config.gypi checking for gypi file: /src/node_modules/xxhash/config.gypi
gyp verb common.gypi checking for gypi file: /src/node_modules/xxhash/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/src/node_modules/xxhash/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/10.13.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/10.13.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.node-gyp/10.13.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/src/node_modules/xxhash',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /root/.node-gyp/10.13.0
gyp verb `which` succeeded for `make` /usr/bin/make
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/src/node_modules/xxhash/build'
  g++ '-DNODE_GYP_MODULE_NAME=hash' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/root/.node-gyp/10.13.0/include/node -I/root/.node-gyp/10.13.0/src -I/root/.node-gyp/10.13.0/deps/openssl/config -I/root/.node-gyp/10.13.0/deps/openssl/openssl/include -I/root/.node-gyp/10.13.0/deps/uv/include -I/root/.node-gyp/10.13.0/deps/zlib -I/root/.node-gyp/10.13.0/deps/v8/include -I../deps/xxhash -I../src -I../../nan  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O2 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF ./Release/.deps/Release/obj.target/hash/src/hash.o.d.raw   -c -o Release/obj.target/hash/src/hash.o ../src/hash.cc
In file included from ../../nan/nan.h:192,
                 from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan_maybe_43_inl.h: In function 'Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)':
../../nan/nan_maybe_43_inl.h:112:15: error: 'class v8::Object' has no member named 'ForceSet'
   return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
               ^~~~~~~~
In file included from ../../nan/nan_new.h:189,
                 from ../../nan/nan.h:198,
                 from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan_implementation_12_inl.h: In static member function 'static Nan::imp::FactoryBase<v8::StringObject>::return_t Nan::imp::Factory<v8::StringObject>::New(v8::Local<v8::String>)':
../../nan/nan_implementation_12_inl.h:337:37: warning: 'static v8::Local<v8::Value> v8::StringObject::New(v8::Local<v8::String>)' is deprecated: Use Isolate* version [-Wdeprecated-declarations]
   return v8::StringObject::New(value).As<v8::StringObject>();
                                     ^
In file included from /root/.node-gyp/10.13.0/include/node/v8.h:26,
                 from /root/.node-gyp/10.13.0/include/node/node.h:63,
                 from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:5053:37: note: declared here
                 static Local<Value> New(Local<String> value));
                                     ^~~
/root/.node-gyp/10.13.0/include/node/v8config.h:324:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../../nan/nan_new.h:189,
                 from ../../nan/nan.h:198,
                 from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan_implementation_12_inl.h:337:37: warning: 'static v8::Local<v8::Value> v8::StringObject::New(v8::Local<v8::String>)' is deprecated: Use Isolate* version [-Wdeprecated-declarations]
   return v8::StringObject::New(value).As<v8::StringObject>();
                                     ^
In file included from /root/.node-gyp/10.13.0/include/node/v8.h:26,
                 from /root/.node-gyp/10.13.0/include/node/node.h:63,
                 from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:5053:37: note: declared here
                 static Local<Value> New(Local<String> value));
                                     ^~~
/root/.node-gyp/10.13.0/include/node/v8config.h:324:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)':
../../nan/nan.h:835:60: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, func, argc, argv);
                                                            ^
In file included from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/node.h:176:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/root/.node-gyp/10.13.0/include/node/node.h:91:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan.h:835:60: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, func, argc, argv);
                                                            ^
In file included from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/node.h:176:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/root/.node-gyp/10.13.0/include/node/node.h:91:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)':
../../nan/nan.h:850:62: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, symbol, argc, argv);
                                                              ^
In file included from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/node.h:169:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/root/.node-gyp/10.13.0/include/node/node.h:91:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan.h:850:62: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, symbol, argc, argv);
                                                              ^
In file included from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/node.h:169:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/root/.node-gyp/10.13.0/include/node/node.h:91:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)':
../../nan/nan.h:865:62: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, method, argc, argv);
                                                              ^
In file included from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/node.h:162:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/root/.node-gyp/10.13.0/include/node/node.h:91:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan.h:865:62: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, method, argc, argv);
                                                              ^
In file included from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/node.h:162:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/root/.node-gyp/10.13.0/include/node/node.h:91:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan.h: In constructor 'Nan::Utf8String::Utf8String(v8::Local<v8::Value>)':
../../nan/nan.h:911:53: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
       v8::Local<v8::String> string = from->ToString();
                                                     ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63,
                 from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
In file included from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan.h:921:74: warning: 'int v8::String::WriteUtf8(char*, int, int*, int) const' is deprecated: Use Isolate* version [-Wdeprecated-declarations]
         length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags);
                                                                          ^
In file included from /root/.node-gyp/10.13.0/include/node/v8.h:26,
                 from /root/.node-gyp/10.13.0/include/node/node.h:63,
                 from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:2659:21: note: declared here
                 int WriteUtf8(char* buffer, int length = -1,
                     ^~~~~~~~~
/root/.node-gyp/10.13.0/include/node/v8config.h:324:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan.h: In member function 'v8::Local<v8::Value> Nan::Callback::Call_(v8::Isolate*, v8::Local<v8::Object>, int, v8::Local<v8::Value>*) const':
../../nan/nan.h:1479:5: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
     ));
     ^
In file included from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/node.h:176:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/root/.node-gyp/10.13.0/include/node/node.h:91:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan.h:1479:5: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
     ));
     ^
In file included from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/node.h:176:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^~~~~~~~~~~~
/root/.node-gyp/10.13.0/include/node/node.h:91:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/common.hpp:6,
                 from ../src/hash_32.hpp:4,
                 from ../src/hash.cc:3:
../../nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker*)':
../../nan/nan.h:1732:62: warning: cast between incompatible function types from 'void (*)(uv_work_t*)' {aka 'void (*)(uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (*)(uv_work_s*, int)'} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from ../src/hash.cc:3:
../src/hash_32.hpp: In static member function 'static uint32_t Hash32::convert_seed(v8::Local<v8::Value>)':
../src/hash_32.hpp:57:38: warning: 'uint32_t v8::Value::Uint32Value() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
         return seed_val->Uint32Value();
                                      ^
In file included from /root/.node-gyp/10.13.0/include/node/v8.h:26,
                 from /root/.node-gyp/10.13.0/include/node/node.h:63,
                 from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:2477:47: note: declared here
   V8_DEPRECATED("Use maybe version", uint32_t Uint32Value() const);
                                               ^~~~~~~~~~~
/root/.node-gyp/10.13.0/include/node/v8config.h:324:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/hash.cc:4:
../src/hash_64.hpp: In static member function 'static uint64_t Hash64::convert_seed(v8::Local<v8::Value>)':
../src/hash_64.hpp:57:38: warning: 'uint32_t v8::Value::Uint32Value() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
         return seed_val->Uint32Value();
                                      ^
In file included from /root/.node-gyp/10.13.0/include/node/v8.h:26,
                 from /root/.node-gyp/10.13.0/include/node/node.h:63,
                 from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:2477:47: note: declared here
   V8_DEPRECATED("Use maybe version", uint32_t Uint32Value() const);
                                               ^~~~~~~~~~~
/root/.node-gyp/10.13.0/include/node/v8config.h:324:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/hash.cc:1:
../src/hash.cc: At global scope:
/root/.node-gyp/10.13.0/include/node/node.h:565:43: warning: cast between incompatible function types from 'void (*)(v8::Handle<v8::Object>)' {aka 'void (*)(v8::Local<v8::Object>)'} to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/root/.node-gyp/10.13.0/include/node/node.h:599:3: note: in expansion of macro 'NODE_MODULE_X'
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/hash.cc:12:3: note: in expansion of macro 'NODE_MODULE'
   NODE_MODULE(hash, Init);
   ^~~~~~~~~~~
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63,
                 from ../src/hash.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]':
/root/.node-gyp/10.13.0/include/node/node_object_wrap.h:85:78:   required from here
/root/.node-gyp/10.13.0/include/node/v8.h:9502:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<node::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.node-gyp/10.13.0/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]':
../../nan/nan_object_wrap.h:66:61:   required from here
/root/.node-gyp/10.13.0/include/node/v8.h:9502:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
make: *** [hash.target.mk:108: Release/obj.target/hash/src/hash.o] Error 1
make: Leaving directory '/src/node_modules/xxhash/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 4.18.4-041804-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /src/node_modules/xxhash
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm verb lifecycle xxhash@0.2.4~install: unsafe-perm in lifecycle false
npm verb lifecycle xxhash@0.2.4~install: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/src/node_modules/xxhash/node_modules/.bin:/src/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
npm verb lifecycle xxhash@0.2.4~install: CWD: /src/node_modules/xxhash
npm info lifecycle xxhash@0.2.4~install: Failed to exec install script
npm timing action:install Completed in 34285ms
npm verb unlock done using /root/.npm/_locks/staging-1a14545af9ac12d4.lock for /src/node_modules/.staging
npm timing stage:rollbackFailedOptional Completed in 5ms
npm timing stage:runTopLevelLifecycles Completed in 38283ms
npm verb stack Error: xxhash@0.2.4 install: `node-gyp rebuild`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
npm verb stack     at EventEmitter.emit (events.js:182:13)
npm verb stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:182:13)
npm verb stack     at maybeClose (internal/child_process.js:962:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
npm verb pkgid xxhash@0.2.4
npm verb cwd /src
npm verb Linux 4.18.4-041804-generic
npm verb argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "--no-optional" "--no-save" "--only=prod" "--build-from-source" "--verbose"
npm verb node v10.13.0
npm verb npm  v6.4.1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xxhash@0.2.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the xxhash@0.2.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 38686ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-02-11T19_26_32_295Z-debug.log
The command '/bin/sh -c NODE_ENV=production OPENCV4NODEJS_DISABLE_AUTOBUILD=1 SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm i --no-optional --no-save --only=prod --build-from-source --verbose' returned a non-zero code: 1
asilvas commented 5 years ago

Not sure, sorry. Might be dependency or build tool issues, unrelated to this project. I suggest a search.

Perhaps others have Dockerfile's they can share to assist?

musicformellons commented 5 years ago

I altered the node version into FROM node:8-alpine as nodebase and now it does run without errors.

musicformellons commented 5 years ago

You don't expose a port in the dockerfile?

asilvas commented 5 years ago

No. Our deployment system takes care of port mappings.

musicformellons commented 5 years ago

After altering in package-lock.json the nan version requirement:

    "xxhash": {
      "version": "0.2.4",
      "resolved": "https://registry.npmjs.org/xxhash/-/xxhash-0.2.4.tgz",
      "integrity": "sha1-i4pIFiz8zCG5IPpQAmEYfUAhbDk=",
      "requires": {
        "nan": "^2.4.0"
      }
    },

into "nan": "^2.10.0" the build also works for node:10.13.0-alpine.

musicformellons commented 5 years ago

I am using image-steam-s3 and now when making a request I get following error:

Error: Cannot find module 'image-steam'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/src/node_modules/image-steam-s3/lib/index.js:9:19)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
ERR: 2019-02-12T10:08:25.066Z GET /myS3testbucket/test.jpeg/:/rs=w:640
musicformellons commented 5 years ago

The above error is caused by 'image-steam' being a dependency of 'image-steam-s3', whereas I am building 'image-steam' and then install 'image-steam-s3'... I think I solved it by making a npm symlink from the image-steam-s3 package.json folder. The error is gone now. Do you have a better approach maybe?

asilvas commented 5 years ago

image-steam is a peerDependency (not a direct dependency) of image-steam-s3, which just means your top-level application must have both of these dependencies installed. You might also want to verify you have the latest npm npm i -g npm.

musicformellons commented 5 years ago

Ah, so could be one or the other!? Interesting, since I simply put 'image-steam-s3' in the package.json of 'image-steam' and then I got the error.

asilvas commented 5 years ago

Typically people create an app with these as dependencies. And you'd list these 2 dependencies in the app's package.json.