forked from ensdomains/offchain-gateway-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (35 loc) · 1.16 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
FROM rust:1.79-buster AS build
# create a new empty shell project
RUN USER=root cargo new --bin offchain-gateway-example-full
WORKDIR /offchain-gateway-example-full
# copy over your manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
# this build step will cache your dependencies
RUN cargo build --release
RUN rm src/*.rs
# copy your source tree
COPY ./src ./src
# build for release
RUN rm ./target/release/deps/offchain_gateway_example_full*
RUN cargo build --release
# our final base
FROM debian:buster-slim
# Set environment variables for non-interactive installation
ENV DEBIAN_FRONTEND=noninteractive
# Update the package list and install the OpenSSL development dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
libssl-dev \
ca-certificates \
wget \
libpq-dev \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
# copy the build artifact from the build stage
COPY --from=build /offchain-gateway-example-full/target/release/offchain-gateway-example-full .
ENV PORT=8080
EXPOSE ${PORT}
# set the startup command to run your binary
CMD ["./offchain-gateway-example-full"]