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= 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..e2a403f 100644 --- a/Makefile +++ b/Makefile @@ -16,16 +16,14 @@ 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 '