-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
193 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* | ||
!/src/ | ||
!/pom.xml | ||
!/settings.xml | ||
!/gpg-params |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
target/ | ||
/target/ | ||
/settings.xml | ||
/gpg-params | ||
/gpg-home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
FROM alpine:3.8 AS download-maven | ||
RUN apk add --no-cache curl | ||
ARG MAVEN_VERSION=3.5.4 | ||
ARG SHA=ce50b1c91364cb77efe3776f756a6d92b76d9038b0a0782f7d53acf1e997a14d | ||
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries | ||
RUN mkdir -p /app /app/ref \ | ||
&& curl -fsSL -o /maven.tar.gz ${BASE_URL}/apache-maven-"${MAVEN_VERSION}"-bin.tar.gz \ | ||
&& echo "${SHA} /maven.tar.gz" | sha256sum -c - \ | ||
&& tar -xzf /maven.tar.gz -C /app --strip-components=1 | ||
|
||
FROM alpine:3.8 AS generate-gpg-key | ||
RUN apk add --no-cache gnupg1 | ||
ENV GNUPGHOME=/key | ||
RUN mkdir -p "${GNUPGHOME}" | ||
COPY gpg-params /gpg-params | ||
RUN gpg --batch --gen-key /gpg-params | ||
|
||
FROM openjdk:9-jdk-slim AS build-jar | ||
RUN ln -s /etc/java-9-openjdk /usr/lib/jvm/java-9-openjdk-$(dpkg --print-architecture)/conf | ||
ENV MAVEN_HOME /usr/share/maven | ||
ENV MAVEN_CONFIG "${HOME}/.m2" | ||
COPY --from=download-maven /app "${MAVEN_HOME}" | ||
RUN ln -s "${MAVEN_HOME}"/bin/mvn /usr/bin/mvn | ||
# Build app | ||
ENV APP_SOURCE /app | ||
WORKDIR /app | ||
COPY pom.xml pom.xml | ||
RUN mvn validate dependency:go-offline | ||
COPY src src | ||
RUN mvn clean compile test | ||
RUN mvn -DskipTests=true package | ||
|
||
FROM build-jar AS build-signed-jar | ||
RUN apt-get update && apt-get install -y gnupg1 && rm -rf /var/lib/apt/lists/* | ||
ENV GNUPGHOME=/key | ||
COPY --from=generate-gpg-key /key "${GNUPGHOME}" | ||
COPY settings.xml /root/.m2/ | ||
RUN mvn -o -DskipTests=true verify | ||
|
||
FROM build-signed-jar AS deploy-snapshot | ||
RUN mvn -DskipTests=true deploy | ||
|
||
FROM build-signed-jar AS deploy-release | ||
RUN mvn -DskipTests=true deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.PHONY: jar signed-jar export-gpg-key deploy-release deploy-snapshot publish-gpg-key | ||
|
||
jar: | ||
mkdir -p target | ||
docker-compose build build-jar | ||
docker-compose run --rm build-jar | ||
deploy-release: publish-gpg-key | ||
docker-compose build deploy-release | ||
deploy-snapshot: publish-gpg-key | ||
docker-compose build deploy-snapshot | ||
signed-jar: export-gpg-key | ||
mkdir -p target | ||
docker-compose build build-signed-jar | ||
docker-compose run --rm build-signed-jar | ||
publish-gpg-key: export-gpg-key | ||
docker-compose build publish-gpg-key | ||
docker-compose run --rm publish-gpg-key | ||
export-gpg-key: gpg-home | ||
gpg-home: | ||
mkdir -p gpg-home | ||
docker-compose build export-gpg-key | ||
docker-compose run --rm export-gpg-key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
version: '3.4' | ||
services: | ||
export-gpg-key: | ||
image: regex-builder:export-gpg-key | ||
build: | ||
context: . | ||
target: generate-gpg-key | ||
volumes: | ||
- type: bind | ||
source: ./gpg-home | ||
target: /output | ||
entrypoint: /bin/sh | ||
command: | ||
- -euxc | ||
- cd "$$GNUPGHOME" && cp -rv . /output | ||
publish-gpg-key: | ||
image: regex-builder:export-gpg-key | ||
build: | ||
context: . | ||
target: generate-gpg-key | ||
entrypoint: /bin/sh | ||
command: | ||
- -euxc | ||
- | | ||
KEY_ID=$$(gpg --list-keys --with-colons | awk -F: '/^pub:/ { print $$5 }'); | ||
gpg --keyserver hkp://pool.sks-keyservers.net --send-keys "$$KEY_ID" & | ||
gpg --keyserver hkp://eu.pool.sks-keyservers.net --send-keys "$$KEY_ID" & | ||
gpg --keyserver hkp://na.pool.sks-keyservers.net --send-keys "$$KEY_ID" & | ||
gpg --keyserver hkp://oc.pool.sks-keyservers.net --send-keys "$$KEY_ID" & | ||
gpg --keyserver hkp://keyserver.ubuntu.com --send-keys "$$KEY_ID" & | ||
wait | ||
build-jar: | ||
image: regex-builder:build-jar | ||
build: | ||
context: . | ||
target: build-jar | ||
volumes: | ||
- type: bind | ||
source: ./target | ||
target: /output | ||
entrypoint: /bin/sh | ||
command: | ||
- -euxc | ||
- cp -rv target/*.jar /output | ||
build-signed-jar: | ||
image: regex-builder:build-signed-jar | ||
build: | ||
context: . | ||
target: build-signed-jar | ||
volumes: | ||
- type: bind | ||
source: ./target | ||
target: /output | ||
entrypoint: /bin/sh | ||
command: | ||
- -euxc | ||
- cp -rv target/*.jar /output | ||
deploy-release: | ||
image: regex-builder:release | ||
build: | ||
context: . | ||
target: deploy-release | ||
deploy-snapshot: | ||
image: regex-builder:snapshot | ||
build: | ||
context: . | ||
target: deploy-snapshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Key-Type: default | ||
Subkey-Type: default | ||
Name-Real: TODO: NAME | ||
Name-Email: TODO: EMAIL | ||
Expire-Date: 0 | ||
Passphrase: TODO: PASSPHRASE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<settings> | ||
<servers> | ||
<server> | ||
<id>ossrh</id> | ||
<username>TODO: USERNAME</username> | ||
<password>TODO: PASSWORD</password> | ||
</server> | ||
</servers> | ||
<profiles> | ||
<profile> | ||
<id>ossrh</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<properties> | ||
<gpg.executable>gpg1</gpg.executable> | ||
<gpg.passphrase>TODO: PASSPHRASE</gpg.passphrase> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
</settings> |