diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..21ad3ac --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,22 @@ +[bumpversion] +current_version = 0.5.1-SNAPSHOT +commit = True +tag = True +sign_tags = True +parse = (?P\d+)\.(?P\d+)\.(?P\d+)(?P-[a-zA-Z]+)? +serialize = + {major}.{minor}.{patch}{release} + {major}.{minor}.{patch} + +[bumpversion:part:release] +optional_value = -GA +first_value = -SNAPSHOT +values = + -SNAPSHOT + -GA + +[bumpversion:part:build] + +[bumpversion:file:build.gradle] + +[bumpversion:file:Dockerfile] diff --git a/.github/workflows/dockerpublish.yml b/.github/workflows/dockerpublish.yml new file mode 100644 index 0000000..1f7d60d --- /dev/null +++ b/.github/workflows/dockerpublish.yml @@ -0,0 +1,69 @@ +name: Docker + +on: + push: + # Publish `0.5.x` as Docker `latest` image. + branches: + - 0.5.x + + # Publish `v1.2.3` tags as releases. + tags: + - v* + + # Run tests for any PRs. + pull_request: + +env: + IMAGE_NAME: openmicroscopy/omero-ms-thumbnail + +jobs: + # Run tests. + # See also https://docs.docker.com/docker-hub/builds/automated-testing/ + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Run tests + run: | + if [ -f docker-compose.test.yml ]; then + docker-compose --file docker-compose.test.yml build + docker-compose --file docker-compose.test.yml run sut + fi + + # Push image to GitHub Packages. + # See also https://docs.docker.com/docker-hub/builds/ + push: + # Ensure test job passes before pushing image. + needs: test + + runs-on: ubuntu-latest + if: github.event_name == 'push' + + steps: + - uses: actions/checkout@v2 + + - name: Build image + run: docker build . --file Dockerfile --tag $IMAGE_NAME + + - name: Log into registry + run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u omereleases --password-stdin + + - name: Push image + run: | + + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + + # Use Docker `latest` tag convention + [ "$VERSION" == "0.5.x" ] && VERSION=latest + + echo IMAGE_NAME=$IMAGE_NAME + echo VERSION=$VERSION + + docker tag $IMAGE_NAME $IMAGE_NAME:$VERSION + docker push $IMAGE_NAME:$VERSION diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b86f8f5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,54 @@ +# Development Dockerfile for Microservices +# ---------------------------------------- +# This dockerfile can be used to build +# a distribution which can then be run +# within a number of different Docker images. + +# By default, building this dockerfile will use +# the IMAGE argument below for the runtime image: + +ARG IMAGE=adoptopenjdk/openjdk11:jre-11.0.7_10-alpine + +# To install the built distribution into other runtimes +# pass a build argument, e.g.: +# +# docker build --build-arg IMAGE=openjdk:9 ... +# + +# Similarly, the GRADLE_IMAGE argument can be overwritten +# but this is generally not needed. +ARG GRADLE_IMAGE=gradle:jdk + +# +# Build phase: Use the gradle image for building. +# +FROM ${GRADLE_IMAGE} as gradle +RUN mkdir -p ms + +COPY build.gradle ms/ +COPY src ms/src +COPY gradle ms/gradle +COPY gradlew ms/gradlew +WORKDIR ms +RUN /bin/bash ./gradlew installDist + + +# +# Install phase: Copy the built distribution into a +# clean container to minimize size. +# +FROM ${IMAGE} +COPY --from=gradle /home/gradle/ms/build/install/ms /opt/ms + +EXPOSE 8080 +ENV JAVA_OPTS "-Xmx1G" + +WORKDIR /opt/ms + + +ARG OMERO_SERVER=omero +ARG REDIS_SERVER=redis +RUN sed -i "s/127.0.0.1:6379/$REDIS_SERVER:6379/" conf/config.yaml +RUN sed -i "s/localhost/$OMERO_SERVER/" conf/config.yaml + +ENTRYPOINT ["sh", "bin/ms"] diff --git a/build.gradle b/build.gradle index 3365a01..244ec2b 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group = 'com.glencoesoftware.omero' -version = '0.5.0' +version = '0.5.1-SNAPSHOT' mainClassName = 'io.vertx.core.Launcher'