generated from holaplex/hub-rust-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
53 lines (43 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
48
49
50
51
52
53
FROM lukemathwalker/cargo-chef:0.1.50-rust-buster AS chef
WORKDIR /app
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
cmake \
g++ \
libsasl2-dev \
libssl-dev \
libudev-dev \
pkg-config \
protobuf-compiler \
&& \
rm -rf /var/lib/apt/lists/*
FROM chef AS planner
COPY Cargo.* ./
COPY api api
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY Cargo.* ./
COPY api api
RUN cargo build --release --bin holaplex-hub-credentials
FROM debian:bullseye-slim as base
WORKDIR /app
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
ca-certificates \
libpq5 \
libssl1.1 \
&& \
rm -rf /var/lib/apt/lists/*
ENV TZ=Etc/UTC
ENV APP_USER=runner
RUN groupadd $APP_USER \
&& useradd --uid 10000 -g $APP_USER $APP_USER \
&& mkdir -p bin
RUN chown -R $APP_USER:$APP_USER bin
USER 10000
COPY --from=builder /app/target/release/holaplex-hub-credentials bin
CMD ["bin/holaplex-hub-credentials"]