Add make targets and checksums to make updating easier

This commit is contained in:
IamTheFij 2019-03-19 18:21:33 -07:00
parent 3f3ebe5194
commit 6a3fa7b629
4 changed files with 47 additions and 4 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
pmd-bin-*.zip

View File

@ -1,13 +1,16 @@
FROM openjdk:13-alpine
LABEL author="ian@iamthefij.com"
ENV VERSION=6.12.0
ARG VERSION=6.12.0
RUN apk add bash curl unzip
RUN curl -L -o pmd.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F${VERSION}/pmd-bin-${VERSION}.zip && \
unzip pmd.zip && \
rm pmd.zip
COPY ./pmd-bin-${VERSION}.zip.sha256 /
RUN curl -L -o pmd-bin-${VERSION}.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F${VERSION}/pmd-bin-${VERSION}.zip && \
sha256sum -c pmd-bin-${VERSION}.zip.sha256 && \
unzip pmd-bin-${VERSION}.zip && \
rm pmd-bin-${VERSION}.zip
RUN mv /pmd-bin-${VERSION} /pmd
WORKDIR /pmd

38
Makefile Normal file
View File

@ -0,0 +1,38 @@
VERSION ?= 6.12.0
DOCKER_TAG ?= pmd-$(USER)
SHA256SUM := $(shell which sha256sum || which gsha256sum)
.PHONY: build
build:
docker build --build-arg VERSION=$(VERSION) . -t $(DOCKER_TAG)
.PHONY: run
run: build
docker run --rm $(DOCKER_TAG) --help
# Downloads latest pmd zip
pmd-bin-$(VERSION).zip:
curl -L -o pmd-bin-$(VERSION).zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F$(VERSION)/pmd-bin-$(VERSION).zip
# Generates new sha256 for this version file
pmd-bin-$(VERSION).zip.sha256: pmd-bin-$(VERSION).zip
$(SHA256SUM) pmd-bin-$(VERSION).zip > pmd-bin-$(VERSION).zip.sha256
# Checks that the downloaded file matches the sha sum
.PHONY: check
check:
$(SHA256SUM) -c pmd-bin-$(VERSION).zip.sha256
# Updates PMD and generates a new sha
.PHONY: update
update: clean pmd-bin-$(VERSION).zip.sha256 check
# Cleans all zips and shas
.PHONY: clean
clean:
rm -f pmd-bin-*.zip pmd-bin-*.zip.sha256
# Creates a git tag for the current pmd version
.PHONY: tag
tag:
git tag -v $(VERSION)

View File

@ -0,0 +1 @@
e61b3855bd94c1a3875b788cfd252a2d4f1232d47a41479078640da9aa3f7ecb pmd-bin-6.12.0.zip