Skip to content

Commit

Permalink
Merge pull request #40 from RADAR-base/release-0.2.2
Browse files Browse the repository at this point in the history
Release 0.2.2
  • Loading branch information
yatharthranjan authored Jan 13, 2022
2 parents c167a11 + 63ac2a7 commit 84ffea9
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 11 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
pull_request:
branches: [ master, dev ]

env:
DOCKER_IMAGE: radarbase/radar-push-endpoint

jobs:
# Build and test the code
build:
Expand Down Expand Up @@ -43,3 +46,83 @@ jobs:
# Gradle check
- name: Check
run: ./gradlew check

# Check that the docker image builds correctly
docker:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Add Docker labels and tags
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: ${{ env.DOCKER_IMAGE }}

# Setup docker build environment
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
id: cache-buildx
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('Dockerfile', '**/*.gradle.kts', 'gradle.properties', 'src/main/**') }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Cache parameters
id: cache-parameters
run: |
if [ "${{ steps.cache-buildx.outputs.cache-hit }}" = "true" ]; then
echo "::set-output name=cache-to::"
else
echo "::set-output name=cache-to::type=local,dest=/tmp/.buildx-cache-new,mode=max"
fi
- name: Build docker
uses: docker/build-push-action@v2
with:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: ${{ steps.cache-parameters.outputs.cache-to }}
load: true
tags: ${{ steps.docker_meta.outputs.tags }}
# Use runtime labels from docker_meta as well as fixed labels
labels: |
${{ steps.docker_meta.outputs.labels }}
maintainer=Joris Borgdorff <joris@thehyve.nl>
org.opencontainers.image.authors=Joris Borgdorff <joris@thehyve.nl>
org.opencontainers.image.vendor=RADAR-base
org.opencontainers.image.licenses=Apache-2.0
- name: Inspect docker image
run: docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}

- name: Check docker image
run: docker run --rm ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} curl --help

# Push the image on the dev and master branches
- name: Push image
if: ${{ github.event_name != 'pull_request' }}
run: docker push ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move docker build cache
if: steps.cache-buildx.outputs.cache-hit != 'true'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,57 @@ jobs:
with:
files: 'build/libs/*;build/distributions/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}


# Build and push tagged release docker image
docker:
# The type of runner that the job will run on
runs-on: ubuntu-latest

env:
DOCKER_IMAGE: radarbase/radar-push-endpoint

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2

# Setup docker build environment
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Add Docker labels and tags
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: ${{ env.DOCKER_IMAGE }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build docker
uses: docker/build-push-action@v2
with:
# Allow running the image on the architectures supported by openjdk:17-jre-slim
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
# Use runtime labels from docker_meta as well as fixed labels
labels: |
${{ steps.docker_meta.outputs.labels }}
maintainer=Yatharth Ranjan <yatharth.ranjan@kcl.ac.uk>
org.opencontainers.image.authors=Yatharth Ranjan <yatharth.ranjan@kcl.ac.uk>
org.opencontainers.image.vendor=RADAR-base
org.opencontainers.image.licenses=Apache-2.0
- name: Inspect docker image
run: |
docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ MAINTAINER @yatharthranjan

LABEL description="RADAR-base Push Api Gateway docker container"

RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /code/build/distributions/radar-push-endpoint-*/bin/* /usr/bin/
COPY --from=builder /code/build/distributions/radar-push-endpoint-*/lib/* /usr/lib/
COPY --from=builder /code/build/libs/radar-push-endpoint-*.jar /usr/lib/
Expand Down
4 changes: 3 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ description = "RADAR Push API Gateway to handle secured data flow to backend."

allprojects {
group = "org.radarbase"
version = "0.2.1.1"
version = "0.2.2"

repositories {
mavenCentral()
maven(url = "https://packages.confluent.io/maven/")
}
}

Expand All @@ -44,6 +45,7 @@ dependencies {

implementation(project(path = ":deprecated-javax", configuration = "shadow"))


implementation("org.radarbase:oauth-client-util:${project.property("radarOauthClientVersion")}")

implementation("org.slf4j:slf4j-api:${project.property("slf4jVersion")}")
Expand Down
20 changes: 10 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
org.gradle.jvmargs=-Xmx3072m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
dockerComposeStopContainers=true

kotlinVersion=1.5.20
okhttp3Version=4.9.1
radarJerseyVersion=0.8.0.1
kotlinVersion=1.6.10
okhttp3Version=4.9.3
radarJerseyVersion=0.8.1
radarCommonsVersion=0.13.2
radarSchemasVersion=0.6.0
radarOauthClientVersion=0.7.1
jacksonVersion=2.12.3
slf4jVersion=1.7.31
log4j2Version=2.16.0
kafkaVersion=2.8.0
radarSchemasVersion=0.7.6
radarOauthClientVersion=0.8.0
jacksonVersion=2.12.2
slf4jVersion=1.7.32
log4j2Version=2.17.0
kafkaVersion=2.8.1
confluentVersion=6.2.0
junitVersion=5.7.2
jedisVersion=3.6.1
grizzlyVersion=3.0.0
grizzlyVersion=3.0.1

0 comments on commit 84ffea9

Please sign in to comment.