forked from ChainSafe/forest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
50 lines (39 loc) · 1.36 KB
/
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
# This Dockerfile is for the main forest binary
#
# Build and run locally:
# ```
# docker build -t forest:latest -f ./Dockerfile .
# docker run --init -it forest
# ```
#
# Build and manually push to Github Container Registry (see https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry)
# ```
# docker build -t ghcr.io/chainsafe/forest:latest .
# docker push ghcr.io/chainsafe/forest:latest
# ```
##
# Build stage
##
FROM rust:1-buster AS build-env
# Install dependencies
RUN apt-get update && apt-get install --no-install-recommends -y build-essential clang ocl-icd-opencl-dev cmake
WORKDIR /usr/src/forest
COPY . .
# Grab the correct toolchain
RUN rustup toolchain install nightly && rustup target add wasm32-unknown-unknown
# Install Forest
RUN make install
# strip symbols to make executable smaller
RUN strip /usr/local/cargo/bin/forest
##
# Prod image for forest binary
##
FROM debian:buster-slim
# Link package to the repository
LABEL org.opencontainers.image.source https://github.com/chainsafe/forest
# Install binary dependencies
RUN apt-get update && apt-get install --no-install-recommends -y ocl-icd-opencl-dev libssl1.1 ca-certificates
RUN update-ca-certificates
# Copy forest binary from the build-env
COPY --from=build-env /usr/local/cargo/bin/forest /usr/local/bin/forest
ENTRYPOINT ["/usr/local/bin/forest"]