From 35ca24adb886721fc9d5e1a68cfc577e2c5f0230 Mon Sep 17 00:00:00 2001 From: jagadam97 Date: Sat, 12 Jul 2025 11:38:30 +0530 Subject: [PATCH] build: improve docker image and binary sizes --- .github/workflows/main.yaml | 2 ++ .goreleaser.yml | 11 +++++++++++ Dockerfile | 2 +- Dockerfile.s6 | 2 +- docker/common/healthcheck.sh | 2 +- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ee01149a..0b053ffd 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -85,6 +85,8 @@ jobs: node-version: "22.x" cache: "pnpm" cache-dependency-path: "frontend/pnpm-lock.yaml" + - name: Install upx + run: sudo apt-get install -y upx - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx diff --git a/.goreleaser.yml b/.goreleaser.yml index 57b7b44a..e59ef7f9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -40,6 +40,17 @@ archives: - goos: windows formats: ["zip"] +upx: + - enabled: true + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + compress: "best" + lzma: true + dockers: # Alpine docker images - dockerfile: Dockerfile diff --git a/Dockerfile b/Dockerfile index 0e64f120..eb5751e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:3.22 RUN apk update && \ - apk --no-cache add ca-certificates mailcap curl jq tini + apk --no-cache add ca-certificates mailcap jq tini # Make user and create necessary directories ENV UID=1000 diff --git a/Dockerfile.s6 b/Dockerfile.s6 index cb34cbd1..7e281ad7 100644 --- a/Dockerfile.s6 +++ b/Dockerfile.s6 @@ -1,7 +1,7 @@ FROM ghcr.io/linuxserver/baseimage-alpine:3.22 RUN apk update && \ - apk --no-cache add ca-certificates mailcap curl jq + apk --no-cache add ca-certificates mailcap jq # Make user and create necessary directories RUN mkdir -p /config /database /srv && \ diff --git a/docker/common/healthcheck.sh b/docker/common/healthcheck.sh index e0ab1e65..3984adb6 100755 --- a/docker/common/healthcheck.sh +++ b/docker/common/healthcheck.sh @@ -6,4 +6,4 @@ PORT=${FB_PORT:-$(jq -r .port /config/settings.json)} ADDRESS=${FB_ADDRESS:-$(jq -r .address /config/settings.json)} ADDRESS=${ADDRESS:-localhost} -curl -f http://$ADDRESS:$PORT/health || exit 1 +wget -q --spider http://$ADDRESS:$PORT/health || exit 1