fixed docker build static
Build and Publish / Build and Publish Docker Image (push) Successful in 3m51s
Build and Publish / Build and Publish Docker Image (push) Successful in 3m51s
This commit is contained in:
+1
-1
@@ -10,6 +10,6 @@ FROM debian:bookworm-slim
|
||||
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /data
|
||||
COPY --from=builder /app/target/release/web-petting /usr/local/bin/web-petting
|
||||
COPY static ./static
|
||||
COPY static /app/static
|
||||
EXPOSE 3000
|
||||
CMD ["web-petting"]
|
||||
|
||||
+2
-2
@@ -400,11 +400,11 @@ async fn serve_static(_request: Request, Path(filename): Path<String>) -> cot::R
|
||||
return Html::new("404").into_response();
|
||||
}
|
||||
let ext = filename.rsplit('.').next().unwrap_or("");
|
||||
// Try relative path first, then /data/static/ (Docker)
|
||||
// Try relative path first, then /app/static/ (Docker)
|
||||
let path = format!("static/{filename}");
|
||||
let data = match tokio::fs::read(&path).await {
|
||||
Ok(d) => d,
|
||||
Err(_) => match tokio::fs::read(format!("/data/static/{filename}")).await {
|
||||
Err(_) => match tokio::fs::read(format!("/app/static/{filename}")).await {
|
||||
Ok(d) => d,
|
||||
Err(_) => return Html::new("404").into_response(),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user