openmemex icon indicating copy to clipboard operation
openmemex copied to clipboard

Frontend fails to build in Docker

Open gmrukwa opened this issue 3 years ago • 2 comments

Hey! I just wanted to check how the app looks like and tried to build the Docker image from scratch with docker build -t openmemex .

The frontend build fails (build-rust intermediate container). It indicates that here Rust compiler expects just extern.

Here's the log:

 > [build-rust 3/3] RUN cd ./frontend && make build:                                                                                                                                       
#23 0.280 wasm-pack build --target web --out-name wasm --release --out-dir ./static                                                                                                        
#23 30.37 [INFO]: Checking for the Wasm target...                                                                                                                                          
#23 30.59 info: downloading component 'rust-std' for 'wasm32-unknown-unknown'                                                                                                              
#23 31.90 info: installing component 'rust-std' for 'wasm32-unknown-unknown'                                                                                                               
#23 33.28 [INFO]: Compiling to Wasm...
#23 34.07    Compiling proc-macro2 v1.0.36
#23 34.07    Compiling unicode-xid v0.2.2
#23 34.07    Compiling syn v1.0.84
#23 34.08    Compiling cfg-if v1.0.0
#23 34.08    Compiling log v0.4.14
#23 34.08    Compiling wasm-bindgen-shared v0.2.78
#23 34.08    Compiling lazy_static v1.4.0
#23 34.41    Compiling bumpalo v3.8.0
#23 34.43    Compiling wasm-bindgen v0.2.78
#23 34.63    Compiling autocfg v1.0.1
#23 34.68    Compiling lexical-core v0.7.6
#23 35.02    Compiling memchr v2.4.1
#23 35.04    Compiling version_check v0.9.4
#23 35.05    Compiling serde_derive v1.0.133
#23 35.09    Compiling ryu v1.0.9
#23 35.17    Compiling serde v1.0.133
#23 35.19    Compiling proc-macro2 v0.4.30
#23 35.23    Compiling static_assertions v1.1.0
#23 35.50    Compiling arrayvec v0.5.2
#23 35.71    Compiling bitflags v1.3.2
#23 35.88    Compiling itoa v1.0.1
#23 36.02    Compiling libc v0.2.112
#23 36.04    Compiling unicode-xid v0.1.0
#23 36.16    Compiling serde_json v1.0.74
#23 36.16    Compiling anyhow v1.0.52
#23 36.17    Compiling tinyvec_macros v0.1.0
#23 36.18    Compiling matches v0.1.9
#23 36.34    Compiling bytes v1.1.0
#23 36.34    Compiling yew v0.18.0
#23 36.35    Compiling boolinator v2.4.0
#23 36.37    Compiling fnv v1.0.7
#23 36.52    Compiling hashbrown v0.11.2
#23 36.58    Compiling cfg-match v0.2.1
#23 36.68    Compiling anymap v0.12.1
#23 36.74    Compiling slab v0.4.5
#23 36.75    Compiling cfg-if v0.1.10
#23 36.83    Compiling unicode-bidi v0.3.7
#23 36.87    Compiling percent-encoding v2.1.0
#23 36.95    Compiling futures v0.1.31
#23 37.10    Compiling scoped-tls v1.0.0
#23 37.10    Compiling urlencoding v2.1.0
#23 37.40    Compiling num-traits v0.2.14
#23 37.51    Compiling indexmap v1.7.0
#23 37.61    Compiling num-integer v0.1.44
#23 37.92    Compiling nom v5.1.2
#23 38.05    Compiling tinyvec v1.5.1
#23 38.20    Compiling form_urlencoded v1.0.1
#23 38.23    Compiling http v0.2.6
#23 42.20    Compiling unicode-normalization v0.1.19
#23 42.37    Compiling quote v1.0.14
#23 43.59    Compiling time v0.1.44
#23 44.01    Compiling quote v0.6.13
#23 44.90    Compiling idna v0.2.3
#23 45.18    Compiling wasm-bindgen-test-macro v0.2.50
#23 46.50    Compiling chrono v0.4.19
#23 46.58    Compiling url v2.2.2
#23 48.54    Compiling yew-router-route-parser v0.15.0
#23 51.89    Compiling wasm-bindgen-backend v0.2.78
#23 53.58    Compiling thiserror-impl v1.0.30
#23 53.58    Compiling yew-macro v0.18.0
#23 53.58    Compiling yew-router-macro v0.15.0
#23 53.63    Compiling wasm-bindgen-macro-support v0.2.78
#23 55.62    Compiling wasm-bindgen-macro v0.2.78
#23 56.77    Compiling thiserror v1.0.30
#23 57.67    Compiling js-sys v0.3.55
#23 57.67    Compiling console_error_panic_hook v0.1.7
#23 61.24    Compiling web-sys v0.3.55
#23 61.24    Compiling wasm-bindgen-futures v0.4.28
#23 61.25    Compiling wasm-bindgen-futures v0.3.27
#23 61.45    Compiling wasm-bindgen-test v0.2.50
#23 64.15    Compiling bincode v1.3.3
#23 71.51    Compiling gloo-events v0.1.1
#23 71.51    Compiling gloo-timers v0.2.2
#23 71.51    Compiling gloo-console-timer v0.1.0
#23 71.51    Compiling wasm-logger v0.2.0
#23 71.69    Compiling gloo-file v0.1.0
#23 71.96    Compiling gloo v0.2.1
#23 74.54    Compiling yew-router v0.15.0
#23 78.13    Compiling frontend v0.1.0 (/src/frontend)
#23 78.27 error: expected `extern`
#23 78.27  --> src/ace.rs:8:1
#23 78.27   |
#23 78.27 8 | pub extern {
#23 78.27   | ^^^
#23 78.27 
#23 78.63 error[E0425]: cannot find function `ace_edit` in this scope
#23 78.63   --> src/ace.rs:87:23
#23 78.63    |
#23 78.63 87 |             let ace = ace_edit(&self.config.id);
#23 78.63    |                       ^^^^^^^^ not found in this scope
#23 78.63 
#23 78.63 error[E0425]: cannot find function `ace_set_theme` in this scope
#23 78.63   --> src/ace.rs:89:13
#23 78.63    |
#23 78.63 89 |             ace_set_theme(ace.clone(),
#23 78.63    |             ^^^^^^^^^^^^^ not found in this scope
#23 78.63 
#23 78.63 error[E0425]: cannot find function `ace_set_mode` in this scope
#23 78.63   --> src/ace.rs:91:13
#23 78.63    |
#23 78.63 91 |             ace_set_mode(ace.clone(),
#23 78.63    |             ^^^^^^^^^^^^ not found in this scope
#23 78.63 
#23 78.63 error[E0425]: cannot find function `ace_set_font_size` in this scope
#23 78.63   --> src/ace.rs:93:13
#23 78.63    |
#23 78.63 93 |             ace_set_font_size(ace.clone(), "20px");
#23 78.63    |             ^^^^^^^^^^^^^^^^^ not found in this scope
#23 78.63 
#23 78.63 error[E0425]: cannot find function `ace_set_keyboard_handler` in this scope
#23 78.63   --> src/ace.rs:94:13
#23 78.63    |
#23 78.63 94 |             ace_set_keyboard_handler(ace.clone(), "ace/keyboard/vim");
#23 78.63    |             ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
#23 78.63 
#23 78.63 error[E0425]: cannot find function `ace_set_show_gutter` in this scope
#23 78.63   --> src/ace.rs:95:13
#23 78.63    |
#23 78.63 95 |             ace_set_show_gutter(ace.clone(), false);
#23 78.63    |             ^^^^^^^^^^^^^^^^^^^ not found in this scope
#23 78.63 
#23 78.63 error[E0425]: cannot find function `ace_add_callback` in this scope
#23 78.63    --> src/ace.rs:104:13
#23 78.63     |
#23 78.63 104 |             ace_add_callback(ace.clone(), &closure);
#23 78.63     |             ^^^^^^^^^^^^^^^^ not found in this scope
#23 78.63     |
#23 78.63 help: consider importing this function
#23 78.63     |
#23 78.63 1   | use crate::external::ace_add_callback;
#23 78.63     |
#23 78.63 
#23 78.63 error[E0425]: cannot find function `ace_get_length` in this scope
#23 78.63    --> src/ace.rs:114:35
#23 78.63     |
#23 78.63 114 |                 let length: u32 = ace_get_length(ace.clone());
#23 78.63     |                                   ^^^^^^^^^^^^^^ not found in this scope
#23 78.63 
#23 78.63 error[E0425]: cannot find function `ace_get_line` in this scope
#23 78.63    --> src/ace.rs:117:41
#23 78.63     |
#23 78.63 117 |                     vec[row as usize] = ace_get_line(ace.clone(), row);
#23 78.63     |                                         ^^^^^^^^^^^^ not found in this scope
#23 78.63 
#23 78.66 warning: unused import: `wasm_bindgen::JsCast`
#23 78.66  --> src/ace.rs:2:5
#23 78.66   |
#23 78.66 2 | use wasm_bindgen::JsCast;
#23 78.66   |     ^^^^^^^^^^^^^^^^^^^^
#23 78.66   |
#23 78.66   = note: `#[warn(unused_imports)]` on by default
#23 78.66 
#23 78.66 warning: unnecessary parentheses around function argument
#23 78.66    --> src/ace.rs:115:65
#23 78.66     |
#23 78.66 115 |                 let mut vec: Vec<String> = vec!["".to_string(); (length as usize)];
#23 78.66     |                                                                 ^               ^
#23 78.66     |
#23 78.66     = note: `#[warn(unused_parens)]` on by default
#23 78.66 help: remove these parentheses
#23 78.66     |
#23 78.66 115 -                 let mut vec: Vec<String> = vec!["".to_string(); (length as usize)];
#23 78.66 115 +                 let mut vec: Vec<String> = vec!["".to_string(); length as usize];
#23 78.66     | 
#23 78.66 
#23 78.66 warning: unused import: `wasm_bindgen::prelude::*`
#23 78.66  --> src/add_note.rs:3:5
#23 78.66   |
#23 78.66 3 | use wasm_bindgen::prelude::*;
#23 78.66   |     ^^^^^^^^^^^^^^^^^^^^^^^^
#23 78.66 
#23 78.66 warning: unused import: `Nothing`
#23 78.66  --> src/add_note.rs:6:20
#23 78.66   |
#23 78.66 6 |     format::{Json, Nothing},
#23 78.66   |                    ^^^^^^^
#23 78.66 
#23 78.66 warning: unused import: `crate::ace::*`
#23 78.66  --> src/app.rs:1:5
#23 78.66   |
#23 78.66 1 | use crate::ace::*;
#23 78.66   |     ^^^^^^^^^^^^^
#23 78.66 
#23 78.66 warning: unused imports: `thread`, `time::Duration`
#23 78.66   --> src/app.rs:12:11
#23 78.66    |
#23 78.66 12 | use std::{thread, time::Duration};
#23 78.66    |           ^^^^^^  ^^^^^^^^^^^^^^
#23 78.66 
#23 78.66 warning: unused import: `Serialize`
#23 78.66  --> src/detail.rs:1:26
#23 78.66   |
#23 78.66 1 | use serde::{Deserialize, Serialize};
#23 78.66   |                          ^^^^^^^^^
#23 78.66 
#23 78.66 warning: unused import: `crate::external::*`
#23 78.66   --> src/detail.rs:12:5
#23 78.66    |
#23 78.66 12 | use crate::external::*;
#23 78.66    |     ^^^^^^^^^^^^^^^^^^
#23 78.66 
#23 78.66 warning: unused import: `yew::web_sys::console`
#23 78.66  --> src/external.rs:2:5
#23 78.66   |
#23 78.66 2 | use yew::web_sys::console;
#23 78.66   |     ^^^^^^^^^^^^^^^^^^^^^
#23 78.66 
#23 78.66 warning: unused import: `wasm_bindgen::prelude::*`
#23 78.66   --> src/timeline.rs:12:5
#23 78.66    |
#23 78.66 12 | use wasm_bindgen::prelude::*;
#23 78.66    |     ^^^^^^^^^^^^^^^^^^^^^^^^
#23 78.66 
#23 78.95 For more information about this error, try `rustc --explain E0425`.
#23 78.97 warning: `frontend` (lib) generated 10 warnings
#23 78.97 error: could not compile `frontend` due to 10 previous errors; 10 warnings emitted
#23 78.98 Error: Compiling your crate to WebAssembly failed
#23 78.98 Caused by: failed to execute `cargo build`: exited with exit status: 101
#23 78.98   full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
#23 78.98 make: *** [Makefile:2: build] Error 1
------
executor failed running [/bin/sh -c cd ./frontend && make build]: exit code: 2

I deleted the pub qualifier in the local clone and it compiles, but the server doesn't find index.html, so probably that's not the way to go.

gmrukwa avatar Jan 02 '22 16:01 gmrukwa

I've needed to add:

ADD ./frontend/static /app/static

before this line.

It still has some problems with thumbnails and "completed", but launches.

gmrukwa avatar Jan 02 '22 17:01 gmrukwa

Thanks for checking things out @gmrukwa ! Feel free to submit a small PR with that fix.

The thumbnails depend on a headless chromium browser, I think we're running into issues packaging it but it's fixable and we're not the first to do that. It's a matter of carving out some bandwidth to troubleshoot the details.

Feel free to join the discord https://discord.gg/mGy29Smv4g - happy to get your feedback or help troubleshoot there.

austinvhuang avatar Jan 02 '22 18:01 austinvhuang