-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
30 lines (22 loc) · 1 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
## -----------------------------------------------------------------------------
## Build
## -----------------------------------------------------------------------------
FROM rust:1.56-slim-buster as build-stage
RUN apt-get update && apt-get install -y --no-install-recommends pkg-config libssl-dev libpq-dev
WORKDIR "/build"
# Install and build crates
COPY Cargo.* /build/
RUN mkdir /build/src && echo "fn main() {}" > /build/src/main.rs
RUN cargo build --release
# Build app
COPY src/ /build/src/
COPY migrations/ /build/migrations/
RUN touch src/main.rs && cargo build --release
## -----------------------------------------------------------------------------
## Package
## -----------------------------------------------------------------------------
FROM ubuntu:21.10
RUN apt-get update && apt-get install -y --no-install-recommends libpq5 openssl ca-certificates
COPY --from=build-stage "/build/target/release/tg-book-of-grumdges" "/app/tg-book-of-grumdges"
WORKDIR "/app"
ENTRYPOINT ["/app/tg-book-of-grumdges"]