From d56fd92ee359623211bba14c6e4ef97bdde92e74 Mon Sep 17 00:00:00 2001 From: Felipe Date: Tue, 28 Feb 2023 01:25:34 -0300 Subject: [PATCH] minify static files (#9) Co-authored-by: Felipe Contreras Salinas Reviewed-on: https://oolong.ludwig.dog/pitbuster/huellas/pulls/9 --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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