-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerfileApp
36 lines (26 loc) · 1 KB
/
DockerfileApp
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
FROM rust:1.70 as build
# create a new empty shell project
RUN USER=root cargo new --bin axum_diesel_async_graphql_template
WORKDIR /axum_diesel_async_graphql_template
# copy over your manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
COPY ./diesel.toml ./diesel.toml
# this build step will cache your dependencies
RUN cargo build --release
RUN rm src/*.rs
# copy your source tree
COPY ./src ./src
COPY ./migrations ./migrations
# build for release
# RUN rm ./target/release/deps/wooboo_v3_be*
RUN cargo build --release
# our final base
FROM debian:12
# copy the build artifact from the build stage
COPY --from=build /axum_diesel_async_graphql_template/target/release/axum_diesel_async_graphql_template .
COPY --from=build /axum_diesel_async_graphql_template/target/release/axum_diesel_async_graphql_template ./migrations
RUN apt-get update && apt-get install -y libpq-dev
RUN mkdir -p test_factory_upload
# set the startup command to run your binary
CMD ["./axum_diesel_async_graphql_template"]