-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathApi.Dockerfile
62 lines (53 loc) · 1.79 KB
/
Api.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
FROM rust:1.75-bullseye AS chef
RUN cargo install cargo-chef
FROM chef AS planner
RUN mkdir /rust
COPY Cargo.toml /rust
COPY core /rust/core
COPY das_api /rust/das_api
COPY digital_asset_types /rust/digital_asset_types
COPY integration_tests /rust/integration_tests
COPY metaplex-rpc-proxy /rust/metaplex-rpc-proxy
COPY migration /rust/migration
COPY nft_ingester /rust/nft_ingester
COPY ops /rust/ops
COPY tools /rust/tools
WORKDIR /rust/das_api
RUN cargo chef prepare --recipe-path /rust/das_api/recipe.json
FROM chef AS builder
RUN apt-get update -y && \
apt-get install -y build-essential make git
RUN mkdir /rust
COPY Cargo.toml /rust
COPY core /rust/core
COPY das_api /rust/das_api
COPY digital_asset_types /rust/digital_asset_types
COPY integration_tests /rust/integration_tests
COPY metaplex-rpc-proxy /rust/metaplex-rpc-proxy
COPY migration /rust/migration
COPY nft_ingester /rust/nft_ingester
COPY ops /rust/ops
COPY tools /rust/tools
WORKDIR /rust/das_api
COPY --from=planner /rust/das_api/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
# TODO: Fix this. For now we are building without the cached dependencies as there's apparently
# some problem with digital-asset-types feature activation.
# RUN cargo chef cook --release --recipe-path recipe.json --target-dir /rust/target --all-features
# Build application
RUN cargo build --release
FROM rust:1.75-slim-bullseye
ARG APP=/usr/src/app
RUN apt update \
&& apt install -y curl ca-certificates tzdata \
&& rm -rf /var/lib/apt/lists/*
ENV TZ=Etc/UTC \
APP_USER=appuser
RUN groupadd $APP_USER \
&& useradd -g $APP_USER $APP_USER \
&& mkdir -p ${APP}
COPY --from=builder /rust/target/release/das_api ${APP}
RUN chown -R $APP_USER:$APP_USER ${APP}
USER $APP_USER
WORKDIR ${APP}
CMD /usr/src/app/das_api