-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (35 loc) · 982 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
37
38
39
40
41
42
43
44
45
46
47
48
49
# Rust
FROM rust:latest as build
# Install dependencies
RUN apt-get -qq update
RUN apt-get install -y -q \
clang \
llvm-dev \
libclang-dev \
cmake \
openssl
RUN cargo install diesel_cli --no-default-features --features postgres
# Set default user
RUN USER=root cargo new --bin health_rules_engine
WORKDIR /health_rules_engine
# Copy over manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
# Copy over migrations
COPY ./migrations ./migrations
COPY ./templates ./templates
# This build to cache dependencies
RUN cargo build --release
RUN rm src/*.rs
# Copy source tree
COPY ./src ./src
# Build for release
RUN rm ./target/release/deps/health_rules_engine*
RUN cargo build --release
# Final base
FROM rust:latest
# Copy final build artifact
COPY --from=build /health_rules_engine/target/release/health_rules_engine .
EXPOSE 8080
# Set startup command
CMD ["./health_rules_engine"]