Very large docker image size optimisations
without cross compiling to linux-musl, optimise image by compiling it on a slim rust image and then transferring only the binary over to a debian-slim image.
This commit is contained in:
+7
-3
@@ -1,8 +1,10 @@
|
||||
use std::net::TcpListener;
|
||||
use sqlx::PgPool;
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
|
||||
use mail_app::startup::run;
|
||||
use mail_app::configuration::get_configuration;
|
||||
use mail_app::telemetry::{get_subscriber, init_subscriber};
|
||||
use std::net::TcpListener;
|
||||
use sqlx::PgPool;
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
@@ -13,7 +15,9 @@ async fn main() -> std::io::Result<()> {
|
||||
let configuration = get_configuration().expect("Failed to read configuration data.");
|
||||
|
||||
// Configure connection to database for our startup
|
||||
let connection_pool = PgPool::connect_lazy(&configuration.database.connection_string())
|
||||
let connection_pool = PgPool::new()
|
||||
.connect_timeout(std::time::Duration::from_secs(2))
|
||||
.connect(&configuration.database.connection_string())
|
||||
.expect("Failed to connect to Postgres.");
|
||||
|
||||
// Take port from settings file
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
use actix_web::{web, App, HttpServer};
|
||||
use actix_web::dev::Server;
|
||||
use actix_web::web::Data;
|
||||
// use actix_web::web::Data;
|
||||
use std::net::TcpListener;
|
||||
use sqlx::PgPool;
|
||||
use tracing_actix_web::TracingLogger;
|
||||
|
||||
Reference in New Issue
Block a user