forked from GSI/bn-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
64 lines (55 loc) · 1.57 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM rust:1.42 as builder
RUN \
wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_0-stable.zip && \
unzip OpenSSL_1_1_0-stable.zip && cd openssl-OpenSSL_1_1_0-stable && \
./config && make -j $(nproc) && make install
ENV LD_LIBRARY_PATH /usr/local/lib
#RUN apt update && apt install \
# libpq-dev \
# musl-tools \
# openssl \
# libssl-dev \
# pkg-config \
# gcc \
# make \
# build-essential \
# -y
# create a new empty shell project
RUN USER=root cargo new --bin bn-api
WORKDIR /bn-api
# Copy the dependency lists
ADD Cargo.docker.toml ./Cargo.toml
# this build step will cache our dependencies
RUN cargo build --release
RUN rm src/*.rs
# Add the actual source code
ADD api ./api/
ADD branch_rs ./branch_rs/
ADD db ./db/
ADD facebook ./facebook/
ADD http ./http/
ADD tari-client ./tari-client/
ADD stripe ./stripe/
ADD logging ./logging/
ADD globee ./globee/
ADD embed_dirs_derive ./embed_dirs_derive/
ADD macros ./macros/
ADD customer_io ./customer_io/
ADD cache ./cache/
ADD sharetribe_flex ./sharetribe_flex/
ADD Cargo.toml ./
RUN cargo build --release
# Create a base minimal image for adding our executables to
FROM bitnami/minideb:stretch as base
RUN apt update && apt install \
openssl \
libpq5 \
curl \
-y
# Now create a new image with only the essentials and throw everything else away
FROM base
COPY --from=builder /bn-api/target/release/server /usr/bin/
COPY --from=builder /bn-api/target/release/bndb_cli /usr/bin/
COPY --from=builder /bn-api/target/release/api-cli /usr/bin/
ADD reset-database.sh /usr/bin/
CMD ["server"]