Skip to content

Commit

Permalink
Merge pull request deegree#102 from deegree/enableGitHubActionsForDocker
Browse files Browse the repository at this point in the history
Enable GitHub actions for docker
  • Loading branch information
stephanr authored Dec 1, 2023
2 parents cc10509 + 0fbf3da commit 4039e48
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file is available under the following license:
# under LGPL 2.1 (LICENSE.TXT) Copyright 2023 Torsten Friebe <[email protected]>
name: Docker Image CI

on:
schedule:
- cron: "0 1 * * *"
push:
branches: [ "main" ]

jobs:

build-1_3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push v1.3
uses: docker/build-push-action@v4
with:
context: ./docker/1.3
platforms: linux/amd64,linux/arm64
push: true
tags: deegree/deegree-ogcapi:1.3,deegree/deegree-ogcapi:1.3-SNAPSHOT,deegree/deegree-ogcapi:latest
23 changes: 23 additions & 0 deletions .github/workflows/build_maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file is available under the following license:
# under LGPL 2.1 (LICENSE.TXT) Copyright 2023 Torsten Friebe <[email protected]>
name: Java CI

on:
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: temurin
cache: 'maven'
- name: Build with Maven
run: mvn -B -q verify --file pom.xml
27 changes: 27 additions & 0 deletions docker/1.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is available under the following license:
# under LGPL 2.1 (LICENSE.TXT) Copyright 2020 Torsten Friebe <[email protected]>
FROM tomcat:9.0-jdk11-temurin-jammy

ENV LANG en_US.UTF-8

# add build info labels that can be set on build
# see also https://github.com/opencontainers/image-spec/blob/master/annotations.md
ARG BUILD_DATE
ARG VCS_REF
ARG VCS_URL
LABEL org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.source=$VCS_URL \
org.opencontainers.image.revision=$VCS_REF
LABEL maintainer="deegree TMC <[email protected]>"

# set deegree OAF version
ENV DEEGREE_OAF_VERSION=1.3-SNAPSHOT

# tomcat port
EXPOSE 8080

# add deegree OGCAPI webapp
RUN curl https://repo.deegree.org/repository/public-ogcapi/org/deegree/deegree-ogcapi-webapp-postgres/${DEEGREE_OAF_VERSION}/deegree-ogcapi-webapp-postgres-${DEEGREE_OAF_VERSION}.war -o /usr/local/tomcat/webapps/deegree-ogcapi.war

# run tomcat
CMD ["catalina.sh", "run"]
25 changes: 24 additions & 1 deletion jenkinsfiles/build/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ pipeline {
environment {
MAVEN_OPTS='-Djava.awt.headless=true -Xmx4096m'
}
parameters {
string name: 'REL_VERSION', defaultValue: "1.3.x", description: 'Next release version'
string name: 'DEV_VERSION', defaultValue: "1.3.x-SNAPSHOT", description: 'Next snapshot version'
booleanParam name: 'PERFORM_RELEASE', defaultValue: false, description: 'Perform release build (on main branch only)'
}
stages {
stage('Initialize') {
steps {
Expand All @@ -21,7 +26,7 @@ pipeline {
}
stage('Build') {
steps {
sh 'mvn -B -fae clean install'
sh 'mvn -B -C -fae clean install'
}
post {
always {
Expand Down Expand Up @@ -56,6 +61,24 @@ pipeline {
}
}
}
stage ('Release') {
when {
allOf {
triggeredBy cause: "UserIdCause", detail: "tmc"
expression { return params.PERFORM_RELEASE }
}
}
steps {
echo 'Prepare release version ${REL_VERSION}'
sh 'mvn -Dresume=false -DreleaseVersion=${REL_VERSION} -DdevelopmentVersion=${DEV_VERSION} -DdeployAtEnd=true -Dgoals=deploy release:prepare release:perform'
}
post {
success {
archiveArtifacts artifacts: '**/target/deegree-ogcapi-webapp-*.war', fingerprint: true
archiveArtifacts artifacts: '**/target/deegree-ogcapi-documentation*.zip', fingerprint: true
}
}
}
}
post {
always {
Expand Down

0 comments on commit 4039e48

Please sign in to comment.