From d678c8771cb31feb28ed984b522ddfa282888fed Mon Sep 17 00:00:00 2001 From: sndsgd Date: Tue, 18 Mar 2025 09:32:23 -0400 Subject: [PATCH 1/5] compile the jarfile --- Dockerfile | 31 ++++++++++++++++++++++--------- Makefile | 19 ++++++++++++------- README.md | 4 ++++ tests/app.js | 5 +---- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index dee987c..173e60c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,25 @@ -FROM alpine:3.20 -LABEL maintainer sndsgd +FROM debian:trixie-slim AS build +ARG VERSION -ARG JARFILE_URL +RUN apt-get update && apt-get install -y \ + build-essential curl gcc git gnupg nodejs openjdk-21-jdk-headless python3 zip -RUN apk add --update --no-cache curl openjdk11-jre \ - && curl ${JARFILE_URL} -o /opt/closure-compiler.jar \ - && chmod 0755 /opt/closure-compiler.jar \ - && echo -e "#!/bin/sh -e\nexec java -jar /opt/closure-compiler.jar \$@" > /usr/local/bin/closure-compiler \ - && chmod +x /usr/local/bin/closure-compiler +WORKDIR /opt +RUN curl -fsSL https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-amd64.deb -o /tmp/bazelisk-amd64.deb \ + && dpkg -i /tmp/bazelisk-amd64.deb -ENTRYPOINT ["/usr/local/bin/closure-compiler"] +RUN git clone --depth=1 --branch ${VERSION} https://github.com/google/closure-compiler.git + +WORKDIR /opt/closure-compiler + +# use the tag from git (as opposed to ${VERSION}) to ensure we have the correct version +RUN GIT_TAG=$(git describe --tags --abbrev=0) && \ + bazelisk build --define=COMPILER_VERSION=$GIT_TAG --verbose_failures //:compiler_uberjar_deploy.jar + +# runtime image +FROM debian:trixie-slim +LABEL maintainer=sndsgd + +RUN apt-get update && apt-get install --yes --no-install-recommends openjdk-21-jre-headless +COPY --from=build /opt/closure-compiler/bazel-bin/compiler_uberjar_deploy.jar /opt/closure-compiler.jar +ENTRYPOINT ["java", "-jar", "/opt/closure-compiler.jar"] diff --git a/Makefile b/Makefile index aa60a08..a41cdb1 100644 --- a/Makefile +++ b/Makefile @@ -16,16 +16,15 @@ help: | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%s\033[0m~%s\n", $$1, $$2}' \ | column -s "~" -t -VERSION_URL ?= https://repo1.maven.org/maven2/com/google/javascript/closure-compiler/ -VERSION_PATTERN ?= '(?<=>)[^/]+(?=/)' +VERSION_URL ?= https://github.com/google/closure-compiler/tags +VERSION_PATTERN ?= '/google/closure-compiler/releases/tag/v[0-9]+' .PHONY: ensure-version ensure-version: ifeq ($(VERSION),) - $(info fetching latest version...) - @$(eval VERSION = $(shell curl -s $(VERSION_URL) | grep ' Date: Tue, 18 Mar 2025 09:33:36 -0400 Subject: [PATCH 2/5] trailing whitespace --- tests/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app.js b/tests/app.js index 119ae19..cee43fb 100644 --- a/tests/app.js +++ b/tests/app.js @@ -5,4 +5,4 @@ console.log(lib.foobar(lib.foobar("--"))); console.log(lib.kilogramsToPounds(100)); document.body.appendChild(lib.createDiv("help")) -document.body.appendChild(lib.createDiv("help", "pls")) \ No newline at end of file +document.body.appendChild(lib.createDiv("help", "pls")) From a21abd8284187487d43866d289aa576b66248c5e Mon Sep 17 00:00:00 2001 From: sndsgd Date: Tue, 18 Mar 2025 09:35:21 -0400 Subject: [PATCH 3/5] derp --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a41cdb1..28cb3ed 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ image: ensure-version @VERSION_OUTPUT=$$(docker run --rm $(IMAGE) --version | grep "Version: " | awk '{print $$2}' | tr -d '[:space:]'); \ if [ "$$VERSION_OUTPUT" != "$(VERSION)" ]; then \ echo "unexpected version: '$$VERSION_OUTPUT' (expected: $(VERSION))"; \ - docker image -rm $(IMAGE); \ + docker image rm $(IMAGE); \ exit 1; \ fi ifeq ($(VERSION),$(FETCHED_VERSION)) From 65a8d7d3a5ba515c645f3f18516ed11fb7b61307 Mon Sep 17 00:00:00 2001 From: sndsgd Date: Tue, 18 Mar 2025 09:38:12 -0400 Subject: [PATCH 4/5] don't need this --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 28cb3ed..e2a403f 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,6 @@ ensure-version: ifeq ($(VERSION),) $(eval VERSION = $(shell curl -s $(VERSION_URL) | grep -Po $(VERSION_PATTERN) | head -n 1 | sed 's|.*/tag/||')) $(eval FETCHED_VERSION = $(VERSION)) - $(info version=$(VERSION) fetchedVersion=$(FETCHED_VERSION)) endif @$(eval IMAGE := $(IMAGE_NAME):$(VERSION)) From 7d5fca593649aa6897b4a9fd829ee19463881f7c Mon Sep 17 00:00:00 2001 From: sndsgd Date: Tue, 18 Mar 2025 09:44:46 -0400 Subject: [PATCH 5/5] keep the cron, nuke the test workflow taking too long to run in the GHA worker. --- .github/workflows/make-test.yml | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .github/workflows/make-test.yml diff --git a/.github/workflows/make-test.yml b/.github/workflows/make-test.yml deleted file mode 100644 index 8440b3f..0000000 --- a/.github/workflows/make-test.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: make-test - -on: - push: - branches: ["*"] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@main - with: - fetch-depth: 1 - - name: Run `make help` - run: make help - - name: Run `make test` - run: make test IMAGE_ARGS=