diff --git a/docker/builder-go.dockerfile b/docker/builder-go.dockerfile new file mode 100644 index 00000000..5d38cf4e --- /dev/null +++ b/docker/builder-go.dockerfile @@ -0,0 +1,16 @@ +############################################ +# Build in Golang +# Run npm run build-healthcheck-armv7 in the host first, another it will be super slow where it is building the armv7 healthcheck +############################################ +FROM golang:1.19.4-buster +WORKDIR /app +ARG TARGETPLATFORM +COPY ./extra/ ./extra/ + +# Compile healthcheck.go +RUN apt update +RUN apt --yes --no-install-recommends install curl +RUN curl -sL https://deb.nodesource.com/setup_18.x | bash +RUN apt --yes --no-install-recommends install nodejs +RUN node -v +RUN node ./extra/build-healthcheck.js $TARGETPLATFORM diff --git a/docker/dockerfile b/docker/dockerfile index e084d649..26f70dd3 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -1,19 +1,9 @@ ############################################ # Build in Golang # Run npm run build-healthcheck-armv7 in the host first, another it will be super slow where it is building the armv7 healthcheck +# Check file: builder-go.dockerfile ############################################ -FROM golang:1.19.4-buster AS build_healthcheck -WORKDIR /app -ARG TARGETPLATFORM -COPY ./extra/ ./extra/ - -# Compile healthcheck.go -RUN apt update -RUN apt --yes --no-install-recommends install curl -RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -RUN apt --yes --no-install-recommends install nodejs -RUN node -v -RUN node ./extra/build-healthcheck.js $TARGETPLATFORM +FROM louislam/uptime-kuma:builder-go AS build_healthcheck ############################################ # Build in Node.js diff --git a/extra/healthcheck.go b/extra/healthcheck.go index 779b1583..302883d8 100644 --- a/extra/healthcheck.go +++ b/extra/healthcheck.go @@ -1,3 +1,7 @@ +/* + * If changed, have to run `npm run build-docker-builder-go`. + * This script should be run after a period of time (180s), because the server may need some time to prepare. + */ package main import ( diff --git a/package.json b/package.json index ebe305f9..0175e4b1 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "build-docker": "npm run build && npm run build-docker-debian && npm run build-docker-alpine", "build-docker-alpine-base": "docker buildx build -f docker/alpine-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base-alpine . --push", "build-docker-debian-base": "docker buildx build -f docker/debian-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base-debian . --push", + "build-docker-builder-go": "docker buildx build -f docker/builder-go.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:builder-go . --push", "build-docker-alpine": "node ./extra/env2arg.js docker buildx build -f docker/dockerfile-alpine --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:alpine -t louislam/uptime-kuma:1-alpine -t louislam/uptime-kuma:$VERSION-alpine --target release . --push", "build-docker-debian": "node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma -t louislam/uptime-kuma:1 -t louislam/uptime-kuma:$VERSION -t louislam/uptime-kuma:debian -t louislam/uptime-kuma:1-debian -t louislam/uptime-kuma:$VERSION-debian --target release . --push", "build-docker-nightly": "npm run build && docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly --target nightly . --push",