CHEFerise docker app to make it more efficient
This commit is contained in:
parent
0a31ae482b
commit
e2c83c817b
15
Dockerfile
15
Dockerfile
@ -1,8 +1,17 @@
|
|||||||
FROM rust:1.56-slim AS builder
|
FROM lukemathwalker/cargo-chef:latest-rust-1.53.0 AS chef
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
|
||||||
|
|
||||||
|
# Create lock file for project to be used in builder
|
||||||
|
FROM chef AS planner
|
||||||
|
COPY . .
|
||||||
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
|
# Build dependancies
|
||||||
|
FROM chef as builder
|
||||||
|
COPY --from=planner /app/recipe.json recipe.json
|
||||||
|
RUN cargo chef cook --release --recipe-path recipe.json
|
||||||
|
|
||||||
|
COPY . .
|
||||||
ENV SQLX_OFFLINE true
|
ENV SQLX_OFFLINE true
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
let configuration = get_configuration().expect("Failed to read configuration data.");
|
let configuration = get_configuration().expect("Failed to read configuration data.");
|
||||||
|
|
||||||
// Configure connection to database for our startup
|
// Configure connection to database for our startup
|
||||||
let connection_pool = PgPool::new()
|
let connection_pool = PgPoolOptions::new()
|
||||||
.connect_timeout(std::time::Duration::from_secs(2))
|
.connect_timeout(std::time::Duration::from_secs(2))
|
||||||
.connect(&configuration.database.connection_string())
|
.connect(&configuration.database.connection_string())
|
||||||
.expect("Failed to connect to Postgres.");
|
.expect("Failed to connect to Postgres.");
|
||||||
|
Loading…
Reference in New Issue
Block a user