From 2906e8280b6c4e0e19b54f9e082a373eeaad1af8 Mon Sep 17 00:00:00 2001 From: Mats Bovin Date: Wed, 23 Aug 2023 15:44:15 +0200 Subject: [PATCH] Build docker container --- .github/workflows/build.yml | 26 +++++++++++++++++++++++++- sbdi/Dockerfile | 10 ++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 sbdi/Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ccf3393..97c6860 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,8 @@ name: Build on: push: + tags: + - 'v*' jobs: @@ -27,5 +29,27 @@ jobs: - name: Upload war uses: actions/upload-artifact@v3 with: - name: Package + name: package path: build/libs + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{ github.repository }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + file: sbdi/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/sbdi/Dockerfile b/sbdi/Dockerfile new file mode 100644 index 0000000..45d698e --- /dev/null +++ b/sbdi/Dockerfile @@ -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