Skip to content

Commit

Permalink
GitHub registry (#4)
Browse files Browse the repository at this point in the history
* fix image building on m1 processor

* fix readme

* add GitHub workflow to build the docker image

* fix workflow

* fix path

* move buildx setup

* try to fix buildx error

* fix invalid tag

* add fix to the dockerfile of the apache builder image

* fix git apply command

* debug

* add local image repository

* rename readme to fix file not found error

* add Dockerfile of builder image
  • Loading branch information
PhilWun authored Mar 24, 2023
1 parent 0d45cea commit e05146d
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 5 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2023 University of Stuttgart

# This file is a modified version of the original that can be found here:
# https://github.com/sathwik/docker-buildr

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM openjdk:8

MAINTAINER Sathwik B P

ENV JRUBY_VERSION 9.1.12.0
ENV BUILDR_VERSION 1.5.3
ENV JRUBY_OPENSSL_VERSION 0.9.17
ENV RSPEC-EXPECTATIONS 2.14.3
ENV RSPEC-MOCKS 2.14.3
ENV RSPEC-CORE 2.14.5
ENV RSPEC 2.14.1
ENV NOKOGIRI 1.6.8

RUN mkdir /opt/jruby \
&& curl http://jruby.org.s3.amazonaws.com/downloads/${JRUBY_VERSION}/jruby-bin-${JRUBY_VERSION}.tar.gz \
| tar -zxC /opt/jruby --strip-components=1 \
&& update-alternatives --install /usr/local/bin/ruby ruby /opt/jruby/bin/jruby 1

ENV PATH /opt/jruby/bin:$PATH

RUN echo 'gem: --no-rdoc --no-ri' >> /.gemrc

RUN gem install bundler -v 2.3.26
RUN gem install jruby-openssl -v ${JRUBY_OPENSSL_VERSION}
RUN gem install buildr -v ${BUILDR_VERSION}
RUN gem install rspec-expectations -v ${RSPEC-EXPECTATIONS}
RUN gem install rspec-mocks -v ${RSPEC-MOCKS}
RUN gem install rspec-core -v ${RSPEC-CORE}
RUN gem install rspec -v ${RSPEC}
RUN gem install nokogiri -v ${NOKOGIRI}

# make /tmp available to all users.
RUN chmod 777 -R /tmp && chmod o+t -R /tmp

RUN update-alternatives --install /usr/local/bin/buildr buildr /opt/jruby/bin/buildr 1 \
&& update-alternatives --install /usr/local/bin/jruby jruby /opt/jruby/bin/jruby 1

ENV WORKSPACE /workspace
VOLUME /workspace
WORKDIR /workspace

ENTRYPOINT [ "buildr" ]
56 changes: 56 additions & 0 deletions .github/workflows/docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Push docker images to the GitHub registry

on:
push:
tags:
- "v*.*.*"
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build_push:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Build Apache Buildr
uses: docker/build-push-action@v4
with:
context: .github/workflows
platforms: linux/amd64,linux/arm64
push: true
tags: localhost:5000/sathwik/apache-buildr:latest-jruby-jdk8
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Login to GitHub registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-workflow
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN jruby -S bundler install --gemfile=/workspace/Gemfile \
FROM tomcat:8.5-jre8
LABEL maintainer "Johannes Wettinger <[email protected]>, Michael Wurster <[email protected]>, Michael Hahn <[email protected]>"

ARG DOCKERIZE_VERSION=v0.3.0
ARG DOCKERIZE_VERSION=v0.6.1

ENV TOMCAT_USERNAME admin
ENV TOMCAT_PASSWORD admin
Expand All @@ -39,6 +39,8 @@ ADD server.xml.tpl ${CATALINA_HOME}/conf/server.xml.tpl
ADD axis2.xml.tpl ${CATALINA_HOME}/webapps/ode/WEB-INF/conf/axis2.xml.tpl
ADD log4j2.xml.tpl ${CATALINA_HOME}/webapps/ode/WEB-INF/classes/log4j2.xml.tpl

RUN mkdir ${CATALINA_HOME}/webapps/manager

EXPOSE 9763

CMD dockerize -template ${CATALINA_HOME}/conf/tomcat-users.xml.tpl:${CATALINA_HOME}/conf/tomcat-users.xml \
Expand Down
66 changes: 66 additions & 0 deletions Dockerfile-workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
FROM localhost:5000/sathwik/apache-buildr:latest-jruby-jdk8 as builder

ENV JAVA_OPTS="-Xmx1024M -XX:MaxPermSize=512M"
ENV BUILDR_ARGS="-f Rakefile clean package test=no JAVADOC=off"

RUN apt-get update -qq && apt-get install -qqy \
unzip \
&& rm -rf /var/lib/apt/lists/*

COPY . /workspace

RUN jruby -S bundler install --gemfile=/workspace/Gemfile \
&& buildr $BUILDR_ARGS \
&& mkdir /build \
&& cp /workspace/axis2-war/target/ode-axis2-war-1.3.8-SNAPSHOT.war /build/ode.war \
&& unzip /build/ode.war -d /build/ode


FROM tomcat:8.5-jre8
LABEL maintainer "Johannes Wettinger <[email protected]>, Michael Wurster <[email protected]>, Michael Hahn <[email protected]>"

ARG DOCKERIZE_VERSION=v0.6.1

ENV TOMCAT_USERNAME admin
ENV TOMCAT_PASSWORD admin
ENV ENGINE_PLAN_PORT 9763
ENV LOG_LEVEL info

RUN rm /dev/random && ln -s /dev/urandom /dev/random \
&& wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz

COPY --from=builder /build/ode ${CATALINA_HOME}/webapps/ode

ADD tomcat-users.xml.tpl ${CATALINA_HOME}/conf/tomcat-users.xml.tpl
ADD manager.xml ${CATALINA_HOME}/conf/Catalina/localhost/manager.xml
ADD server.xml.tpl ${CATALINA_HOME}/conf/server.xml.tpl
ADD axis2.xml.tpl ${CATALINA_HOME}/webapps/ode/WEB-INF/conf/axis2.xml.tpl
ADD log4j2.xml.tpl ${CATALINA_HOME}/webapps/ode/WEB-INF/classes/log4j2.xml.tpl

RUN mkdir ${CATALINA_HOME}/webapps/manager

EXPOSE 9763

CMD dockerize -template ${CATALINA_HOME}/conf/tomcat-users.xml.tpl:${CATALINA_HOME}/conf/tomcat-users.xml \
-template ${CATALINA_HOME}/conf/server.xml.tpl:${CATALINA_HOME}/conf/server.xml \
-template ${CATALINA_HOME}/webapps/ode/WEB-INF/conf/axis2.xml.tpl:${CATALINA_HOME}/webapps/ode/WEB-INF/conf/axis2.xml \
-template ${CATALINA_HOME}/webapps/ode/WEB-INF/classes/log4j2.xml.tpl:${CATALINA_HOME}/webapps/ode/WEB-INF/classes/log4j2.xml \
${CATALINA_HOME}/bin/catalina.sh run

#
# Manually build by running:
#
# docker build -t opentosca/ode:local .
#
# Run ODE container:
#
# docker run -d -p 9763:9763 --name ode opentosca/ode:local
#
# Set a logging level different than "warn", e.g., for debugging process executions.
# Possible values are: all, trace, debug, info, warn, error, fatal, off.
# Visit Apache Log4j2 website for more details: https://logging.apache.org/log4j/2.x/.
#
# docker run -d -p 9763:9763 -e "LOG_LEVEL=debug" --name ode opentosca/ode:local
#
14 changes: 11 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
==============
Apache ODE
==============
# Apache ODE

Apache ODE is a WS-BPEL compliant web services orchestration engine.
It organizes web services calls following a process description
Expand Down Expand Up @@ -34,3 +32,13 @@ Finally here is a non exhaustive but representative features list:
with virtually any communication layer or even embed it.


## Docker
### Build image on M1 Processor

Clone the repo https://github.com/sathwik/docker-buildr go to the folder `jruby-jdk8` build the image with:

`docker build -t sathwik/apache-buildr:latest-jruby-jdk8 .`

Go to the ODE folder and build the image with:

`docker build -t opentosca/ode:latest .`
2 changes: 1 addition & 1 deletion server.xml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
maxSwallowSize="-1" />
maxSwallowSize="-1" secretRequired="false" />


<!-- An Engine represents the entry point (within Catalina) that processes
Expand Down

0 comments on commit e05146d

Please sign in to comment.