Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile #4

Merged
merged 11 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[bumpversion]
current_version = 0.5.1-SNAPSHOT
commit = True
tag = True
sign_tags = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<release>-[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]
69 changes: 69 additions & 0 deletions .github/workflows/dockerpublish.yml
Original file line number Diff line number Diff line change
@@ -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
54 changes: 54 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = 'com.glencoesoftware.omero'
version = '0.5.0'
version = '0.5.1-SNAPSHOT'

mainClassName = 'io.vertx.core.Launcher'

Expand Down