-
Notifications
You must be signed in to change notification settings - Fork 779
/
ecash-lib.Dockerfile
64 lines (50 loc) · 1.7 KB
/
ecash-lib.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright (c) 2024 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Stage 1 - rust machine for building ecash-lib-wasm
FROM rust:1.76.0 AS WasmBuilder
RUN apt-get update \
&& apt-get install clang binaryen -y \
&& rustup target add wasm32-unknown-unknown \
&& cargo install -f [email protected]
# Copy Cargo.toml
WORKDIR /app/
COPY Cargo.toml .
# Copy chronik to same directory structure as monorepo
# This needs to be in place to run ./build-wasm
WORKDIR /app/chronik/
COPY chronik/ .
# Copy secp256k1 to same directory structure as monorepo
WORKDIR /app/src/secp256k1
COPY src/secp256k1/ .
# Copy ecash-secp256k1, ecash-lib and ecash-lib-wasm files to same directory structure as monorepo
WORKDIR /app/modules/ecash-secp256k1
COPY modules/ecash-secp256k1 .
WORKDIR /app/modules/ecash-lib
COPY modules/ecash-lib .
WORKDIR /app/modules/ecash-lib-wasm
COPY modules/ecash-lib-wasm .
# Build web assembly for ecash-lib
RUN CC=clang ./build-wasm.sh
# Stage 2 - Node image for running npm publish
FROM node:20-bookworm-slim
# Copy static assets from WasmBuilder stage (ecash-lib-wasm and ecash-lib, with wasm built in place)
WORKDIR /app/modules
COPY --from=WasmBuilder /app/modules .
# Build out local dependencies of ecash-lib
# ecashaddrjs (dependency of chronik-client)
WORKDIR /app/modules/ecashaddrjs
COPY modules/ecashaddrjs/ .
RUN npm ci
RUN npm run build
# chronik-client
WORKDIR /app/modules/chronik-client
COPY modules/chronik-client/ .
RUN npm ci
RUN npm run build
# Build ecash-lib
WORKDIR /app/modules/ecash-lib
RUN npm ci
RUN npm run build
# Publish ecash-lib
CMD [ "npm", "publish" ]