chore: use release build in docker (#440)

* chore: use release build in docker

* chore: remove assert

* chore: update path
This commit is contained in:
Nathan.fooo 2024-04-03 14:30:46 +08:00 committed by GitHub
parent 6137b6a9ab
commit 2cc5d75d01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 7 deletions

View File

@ -21,7 +21,7 @@ ENV SQLX_OFFLINE true
# Build the project
RUN echo "Building with features: ${FEATURES}"
RUN cargo build --profile=profiling --features "${FEATURES}" --bin appflowy_cloud
RUN cargo build --profile=release --features "${FEATURES}" --bin appflowy_cloud
FROM debian:bookworm-slim AS runtime
@ -33,7 +33,7 @@ RUN apt-get update -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/profiling/appflowy_cloud /usr/local/bin/appflowy_cloud
COPY --from=builder /app/target/release/appflowy_cloud /usr/local/bin/appflowy_cloud
ENV APP_ENVIRONMENT production
ENV RUST_BACKTRACE 1
CMD ["appflowy_cloud"]

View File

@ -19,7 +19,7 @@ use std::pin::Pin;
use tokio::io::{AsyncRead, AsyncReadExt};
use tokio_stream::StreamExt;
use tokio_util::io::StreamReader;
use tracing::{event, instrument};
use tracing::{error, event, instrument};
use crate::state::AppState;
@ -59,7 +59,12 @@ async fn put_blob_handler(
let mut payload_reader = payload_to_async_read(payload);
let mut content = vec![0; content_length];
let n = payload_reader.read_exact(&mut content).await?;
assert_eq!(n, content_length);
if n != content_length {
error!(
"Content length is {}, but the actual content is larger",
content_length
);
}
let res = payload_reader.read_u8().await;
match res {
Ok(_) => {

View File

@ -43,7 +43,7 @@ use std::net::TcpListener;
use std::sync::Arc;
use std::time::Duration;
use tokio::sync::RwLock;
use tracing::info;
use tracing::{info, warn};
pub struct Application {
port: u16,
@ -305,8 +305,11 @@ async fn setup_admin_account(
.await
.context("failed to update the admin user")?;
assert_eq!(result.rows_affected(), 1);
info!("Admin user created and set role to supabase_admin");
if result.rows_affected() != 1 {
warn!("Failed to update the admin user");
} else {
info!("Admin user created and set role to supabase_admin");
}
Ok(gotrue_admin)
},