From 10503f8deedb61c400963dcb344b1f1f712d70ac Mon Sep 17 00:00:00 2001 From: MickaelK Date: Sat, 6 Sep 2025 01:40:57 +1000 Subject: [PATCH] feature (binarysize): shrink binary size --- Jenkinsfile | 1 - Makefile | 3 --- docker/Dockerfile | 14 +++----------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e9f24d93..455d4666 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,6 @@ pipeline { docker.image("node:20").inside("--user=root") { sh "apt update -y && apt install -y brotli" sh "npm install" - sh "make build_frontend" } docker.image("golang:1.24-bookworm").inside("--user=root") { sh "apt update -y && apt install -y libbrotli-dev brotli" diff --git a/Makefile b/Makefile index dc5d8d2f..0337d839 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,6 @@ build_init: go get ./... go generate -x ./server/... -build_frontend: - cd public && make compress - build_backend: CGO_ENABLED=1 go build --tags "fts5" -o dist/filestash cmd/main.go diff --git a/docker/Dockerfile b/docker/Dockerfile index bea98e79..bfc3be2a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,18 +5,10 @@ ARG GIT_REPO=https://github.com/mickael-kerjean/filestash ARG GIT_BRANCH=master RUN git clone --depth 1 --single-branch --branch ${GIT_BRANCH} ${GIT_REPO} -# STEP2: BUILD FRONTEND -FROM node:18-alpine AS builder_frontend -WORKDIR /home/filestash/ -COPY --from=builder_prepare /home/filestash . -RUN apk add make git gzip brotli && \ - npm install --legacy-peer-deps && \ - make build_frontend - -# STEP3: BUILD BACKEND +# STEP2: BUILD BACKEND FROM golang:1.24-trixie AS builder_backend WORKDIR /home/filestash/ -COPY --from=builder_frontend /home/filestash/ . +COPY --from=builder_prepare /home/filestash/ . RUN apt-get update > /dev/null && \ apt-get install -y curl make > /dev/null 2>&1 && \ apt-get install -y libjpeg-dev libtiff-dev libpng-dev libwebp-dev libraw-dev libheif-dev libgif-dev libvips-dev > /dev/null 2>&1 && \ @@ -25,7 +17,7 @@ RUN apt-get update > /dev/null && \ mkdir -p ./dist/data/state/config/ && \ cp config/config.json ./dist/data/state/config/config.json -# STEP4: BUILD PROD IMAGE +# STEP3: BUILD PROD IMAGE FROM debian:stable-slim MAINTAINER mickael@kerjean.me WORKDIR /app/