Skip to content

Commit

Permalink
Add build workflow and Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
matsbov committed Aug 23, 2023
1 parent fa4aaac commit eb0490d
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build

on:
push:
branches:
- '*'
tags:
- 'v*'

jobs:

build:

runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run build with Gradle Wrapper
run: ./gradlew build

- name: Upload war
uses: actions/upload-artifact@v3
with:
name: package
path: build/libs

- name: Log in to the Container registry
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker image
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: docker/build-push-action@v4
with:
context: .
file: sbdi/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
10 changes: 10 additions & 0 deletions sbdi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM tomcat:9.0-jdk11-temurin

RUN mkdir -p \
/data/dashboard/config \
/data/dashboard/csv \
/data/dashboard/zip

COPY sbdi/data/data.json /data/dashboard/data.json

COPY build/libs/dashboard-2.5.0-plain.war $CATALINA_HOME/webapps/ROOT.war

0 comments on commit eb0490d

Please sign in to comment.