streamline docker publish

This commit is contained in:
Jonathan Shook 2020-05-21 15:18:10 -05:00
parent d0ae1dd286
commit 55b21edc13
3 changed files with 35 additions and 39 deletions

View File

@ -1,43 +1,39 @@
name: dockerhub name: dockerhub
on: on:
push: release:
tags: types: [published]
- nosqlbench-**
jobs: jobs:
build:
docker_push:
name: docker_push
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Get the version
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
- name: Build the tagged Docker image
run: docker build ./nb/ --file Dockerfile --tag nosqlbench/nosqlbench:${{steps.vars.outputs.tag}}
- name: Push the tagged Docker image
run: docker push nosqlbench/nosqlbench:${{steps.vars.outputs.tag}}
- name: Build the latest Docker image
run: docker build ./nb/ --file Dockerfile --tag nosqlbench/nosqlbench:latest
- name: Push the latest Docker image
run: docker push nosqlbench/nosqlbench:latest
#jobs: (copied from docker.yml, this snippet references non-extant Dockerfile-build - uses: actions/checkout@v2
# build: name: checkout nosqlbench
# runs-on: ubuntu-latest - uses: actions/setup-java@v1
# steps: name: setup java
# - uses: actions/checkout@master with:
# - name: Build nosqlbench docker java-version: '14'
# run: cd nb && docker build -t nosqlbench -f ./Dockerfile-build ./ java-package: jdk
# - name: Publish to Registry architecture: x64
# uses: elgohr/Publish-Docker-Github-Action@master
# with: - name: Cache Maven packages
# name: nosqlbench/nosqlbench uses: actions/cache@v1
# username: ${{ secrets.DOCKER_USERNAME }} with:
# password: ${{ secrets.DOCKER_PASSWORD }} path: ~/.m2
# tag_names: true key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
# dockerfile: Dockerfile restore-keys: ${{ runner.os }}-m2
# workdir: nb
- name: mvn package
run: mvn package -DskipTests
- name: Push to Docker Hub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: nosqlbench/nosqlbench
tag_with_ref: true

3
Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM openjdk:14-alpine
COPY nb/target/nb.jar nb.jar
ENTRYPOINT ["java","-jar", "nb.jar"]

View File

@ -1,3 +0,0 @@
FROM openjdk:13-alpine
COPY target/ target
ENTRYPOINT ["java","-jar", "/target/nb.jar"]