Fix Docker build for using napi-rs
This commit is contained in:
		
							parent
							
								
									b73437a311
								
							
						
					
					
						commit
						b916a3ee66
					
				@ -79,6 +79,8 @@ Query OK, 0 rows affected (0.00 sec)
 | 
			
		||||
 | 
			
		||||
_Make sure to use Node.js 16.10 and npm 7._
 | 
			
		||||
 | 
			
		||||
_The build process requires [Rust](https://www.rust-lang.org/tools/install) to be installed._
 | 
			
		||||
 | 
			
		||||
Install dependencies with `npm` and build the backend:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -24,8 +24,8 @@
 | 
			
		||||
    "tsc": "./node_modules/typescript/bin/tsc -p tsconfig.build.json",
 | 
			
		||||
    "build": "npm run build-rust && npm run tsc && npm run create-resources",
 | 
			
		||||
    "create-resources": "cp ./src/tasks/price-feeds/mtgox-weekly.json ./dist/tasks && node dist/api/fetch-version.js",
 | 
			
		||||
    "package": "npm run build && rm -rf package && mv dist package && mv node_modules package && npm run package-rm-build-deps",
 | 
			
		||||
    "package-rm-build-deps": "(cd package/node_modules; rm -r typescript @typescript-eslint)",
 | 
			
		||||
    "package": "npm run build && rm -rf package && mv dist package && mv node_modules package && mv rust-gbt package && npm run package-rm-build-deps",
 | 
			
		||||
    "package-rm-build-deps": "(cd package/node_modules; rm -r typescript @typescript-eslint @napi-rs ../rust-gbt/target ../rust-gbt/node_modules ../rust-gbt/src)",
 | 
			
		||||
    "start": "node --max-old-space-size=2048 dist/index.js",
 | 
			
		||||
    "start-production": "node --max-old-space-size=16384 dist/index.js",
 | 
			
		||||
    "reindex-updated-pools": "npm run start-production --update-pools",
 | 
			
		||||
 | 
			
		||||
@ -8,6 +8,8 @@ This project was bootstrapped by [napi](https://www.npmjs.com/package/@napi-rs/c
 | 
			
		||||
 | 
			
		||||
Installing gbt requires a [supported version of Node and Rust](https://github.com/napi-rs/napi-rs#platform-support).
 | 
			
		||||
 | 
			
		||||
The build process also requires [Rust](https://www.rust-lang.org/tools/install) to be installed.
 | 
			
		||||
 | 
			
		||||
You can install the project with npm. In the project directory, run:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,12 @@ WORKDIR /build
 | 
			
		||||
COPY . .
 | 
			
		||||
 | 
			
		||||
RUN apt-get update
 | 
			
		||||
RUN apt-get install -y build-essential python3 pkg-config
 | 
			
		||||
RUN apt-get install -y build-essential python3 pkg-config curl
 | 
			
		||||
 | 
			
		||||
# Install Rust via rustup
 | 
			
		||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
 | 
			
		||||
ENV PATH="/root/.cargo/bin:$PATH"
 | 
			
		||||
 | 
			
		||||
RUN npm install --omit=dev --omit=optional
 | 
			
		||||
RUN npm run package
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user