Created
December 31, 2022 20:24
-
-
Save derekmerck/1b8b1a3ceefd0d0184ad96cd419f106e to your computer and use it in GitHub Desktop.
Instant VisionCortex vtracer node with Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/visioncortex/vtracer | |
# usage: | |
# > docker build -f vtracer.Dockerfile -t vtracer:0.5 . | |
# > docker run -p 8080:8080 vtracer | |
FROM rust | |
# install wasm-pack | |
RUN cargo install wasm-pack | |
# fix problem with binary for wasm-opt on m1-mac | |
RUN apt update && apt install -y binaryen | |
# install nvm and npm | |
RUN mkdir /usr/local/nvm | |
ENV NVM_DIR /usr/local/nvm | |
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \ | |
&& . $NVM_DIR/nvm.sh \ | |
&& nvm install --lts | |
WORKDIR /opt | |
RUN git clone https://github.com/visioncortex/vtracer.git | |
WORKDIR /opt/vtracer/webapp | |
# different way to ignore problem with wasm-opt on mac-m1 | |
# <https://github.com/rustwasm/wasm-pack/issues/913#issuecomment-783482463> | |
# RUN printf '\n\n[package.metadata.wasm-pack.profile.release]\nwasm-opt = false' >> Cargo.toml | |
RUN wasm-pack build | |
WORKDIR /opt/vtracer/webapp/app | |
RUN . $NVM_DIR/nvm.sh && npm install | |
# ignore problem w ssl | |
ENV NODE_OPTIONS "--openssl-legacy-provider" | |
# set dev server to listen on outside ports | |
RUN sed -i 's&//host&host&g' webpack.config.js | |
CMD . $NVM_DIR/nvm.sh && npm run start | |
EXPOSE 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment