chore: update dockerfile for templates
parent
4a4b8bba3d
commit
1d910bc421
|
@ -3,3 +3,4 @@
|
|||
!Cargo.toml
|
||||
!Cargo.lock
|
||||
!src/**
|
||||
!templates/**
|
||||
|
|
13
Dockerfile
13
Dockerfile
|
@ -24,8 +24,9 @@ RUN cargo build --release --frozen
|
|||
|
||||
FROM alpine:3.21
|
||||
|
||||
COPY --from=builder /app/target/release/calathea /bin/calathea
|
||||
COPY --from=builder /app/dumb-init /bin/dumb-init
|
||||
COPY --from=builder /app/target/release/calathea /app/calathea
|
||||
COPY --from=builder /app/dumb-init /app/dumb-init
|
||||
COPY templates /app/templates
|
||||
|
||||
# Create a non-root user & make sure it can write to the data directory
|
||||
RUN set -x && \
|
||||
|
@ -35,9 +36,9 @@ RUN set -x && \
|
|||
|
||||
WORKDIR /data
|
||||
|
||||
ENV TEMPLATE_DIR=/app/templates
|
||||
|
||||
USER www-data:www-data
|
||||
|
||||
ENTRYPOINT [ "/bin/dumb-init", "--" ]
|
||||
CMD [ "/bin/calathea" ]
|
||||
|
||||
|
||||
ENTRYPOINT [ "/app/dumb-init", "--" ]
|
||||
CMD [ "/app/calathea" ]
|
||||
|
|
|
@ -32,7 +32,9 @@ async fn main() {
|
|||
let pool = r2d2::Pool::new(manager).unwrap();
|
||||
db::run_migrations(&pool, &MIGRATIONS).unwrap();
|
||||
|
||||
let tera = Tera::new("templates/**/*").unwrap();
|
||||
let template_dir = std::env::var("TEMPLATE_DIR").unwrap_or(String::from("./templates"));
|
||||
let tera = Tera::new(&format!("{template_dir}/**/*")).unwrap();
|
||||
|
||||
let ctx = Context {
|
||||
pool,
|
||||
tera: Arc::new(tera),
|
||||
|
|
Loading…
Reference in New Issue