-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
36 lines (24 loc) · 998 Bytes
/
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
FROM rust:alpine as chef
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
ENV OPENSSL_LIB_DIR=/usr/lib/
ENV OPENSSL_INCLUDE_DIR=/usr/include
ENV OPENSSL_STATIC=yes
RUN apk update && apk add musl-dev openssl-dev openssl-libs-static ca-certificates-bundle
RUN cargo install cargo-chef --locked
FROM chef as recipe
WORKDIR /var/chef
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef as setup
WORKDIR /usr/financial/src
COPY --from=recipe /var/chef/recipe.json .
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo chef cook --release --target=x86_64-unknown-linux-musl --recipe-path recipe.json
COPY . .
RUN cargo build --release --target=x86_64-unknown-linux-musl
FROM scratch
COPY --from=setup /etc/ssl1.1/certs /etc/ssl/certs
COPY --from=setup /usr/financial/src/schema.sql /var/app/schema.sql
COPY --from=setup /usr/financial/src/target/x86_64-unknown-linux-musl/release/rust_stack_example /usr/local/bin/financial_data
EXPOSE 8000
ENTRYPOINT [ "financial_data" ]