diff --git a/Dockerfile b/Dockerfile index 064bdb9..3c944f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ##### Builder #### FROM rust:1.64-alpine as builder -RUN apk add --no-cache sqlite npm musl-dev +RUN apk add --no-cache sqlite npm musl-dev fd minify # Install Typescript RUN npm install -g typescript @@ -47,6 +47,11 @@ RUN tsc # Delete the first line of jvascript ts-client RUN sed -i '1d' build/client.js +# Minify static files +COPY static /usr/src/huellas/static/ +RUN fd -e html . '/usr/src/huellas/static/' -x minify -r -o {} {} +RUN fd -e js . '/usr/src/huellas/ts-client/build/' -x minify -r -o {} {} + ################ ##### Runtime FROM alpine:3.16 AS Runtime @@ -59,7 +64,7 @@ COPY --from=builder /usr/src/huellas/target/release/huellas /usr/local/bin COPY Rocket.toml /usr/local/bin # Copy static files -COPY static /usr/local/bin/static/ +COPY --from=builder /usr/src/huellas/static /usr/local/bin/static/ # Copy javascript client COPY --from=builder /usr/src/huellas/ts-client/build/client.js /usr/local/bin/static