From df2853dfd1a392ecb64ca6e3f62fd940cedf99f2 Mon Sep 17 00:00:00 2001 From: perennial Date: Sat, 12 Oct 2024 04:00:32 +1100 Subject: [PATCH] fix borked Docker builds --- Dockerfile | 2 +- build.sh | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e3483e6..f4258b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ COPY . . # Build the application RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg \ - ./build.sh build + ./build.sh build_docker # Stage for creating the non-privileged user FROM alpine:3.20 AS user-stage diff --git a/build.sh b/build.sh index c448d9a..a142425 100755 --- a/build.sh +++ b/build.sh @@ -34,6 +34,12 @@ build() { CGO_ENABLED=0 go build -v -ldflags="-extldflags=-static -X codeberg.org/vnpower/pixivfe/v2/config.REVISION=${REVISION}" -o "${BINARY_NAME}" } +build_docker() { + echo "Building ${BINARY_NAME}..." + go mod tidy + CGO_ENABLED=0 go build -v -ldflags="-extldflags=-static -X codeberg.org/vnpower/pixivfe/v2/config.REVISION=${REVISION}" -o "${BINARY_NAME}" +} + test() { echo "Running tests..." go test ./... @@ -109,6 +115,7 @@ help() { echo " all - Run fmt, build, and test" echo " fmt - Format Go code" echo " build - Build the binary" + echo " build_docker - Build the binary (for Docker, skips i18n refresh)" echo " scan - Scan Go code" echo " test - Run tests" echo " i18n - Extract i18n strings" @@ -135,6 +142,7 @@ execute_command() { case "$1" in fmt) fmt ;; build) build ;; + build_docker) build_docker ;; test) test ;; scan) scan ;; i18n) i18n ;;