forked from stefanprokopdev/api-goat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (23 loc) · 747 Bytes
/
Dockerfile
File metadata and controls
32 lines (23 loc) · 747 Bytes
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
FROM rust as build
WORKDIR /usr/src
RUN USER=root cargo new api
WORKDIR /usr/src/api
RUN CARGO_INSTALL_ROOT=. cargo install diesel_cli --no-default-features --features postgres
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
RUN cargo build --release
RUN rm -rf target/release/*
RUN rm src/*.rs
COPY . .
RUN cargo build --release
FROM ubuntu
RUN apt-get update
RUN apt-get install -y libpq-dev
COPY --from=build /usr/src/api/target/release/api-goat .
COPY --from=build /usr/src/api/.env .
COPY --from=build /usr/src/api/migrations ./migrations
COPY --from=build /usr/src/api/docker-compose-entrypoint.sh .
COPY --from=build /usr/src/api/bin/diesel .
RUN chmod u+x docker-compose-entrypoint.sh
EXPOSE 3000
CMD ["./api-goat"]