Skip to content

Commit

Permalink
OK-735: Build and deploy docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
heidilm committed Nov 27, 2024
1 parent 8b22f82 commit 931914f
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v4
id: restore-build
with:
path: |
ovara-backend/target
key: ${{ github.sha }}

- name: Cache local Maven repository
uses: actions/cache@v4
with:
Expand All @@ -39,3 +46,37 @@ jobs:
run: |
cd ovara-backend
mvn clean package -B -DskipTests
deploy-container:
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/cache@v4
id: restore-build
with:
path: |
ovara-backend/target
key: ${{ github.sha }}

- name: Build and deploy Docker container
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
set -euo pipefail
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
export ARTIFACT_NAME="ovara-backend"
export BASE_IMAGE="baseimage-fatjar-openjdk21:master"
source ci-tools/common/setup-tools.sh
printf "HELLO\n"
ls ovara-backend
mv ovara-backend/target/ovara-backend-*.jar $DOCKER_BUILD_DIR/artifact/${ARTIFACT_NAME}.jar
cp -vr ovara-backend/src/main/resources/application.properties $DOCKER_BUILD_DIR/config/
./ci-tools/common/pull-image.sh
./ci-tools/github-build/build-fatjar.sh $ARTIFACT_NAME
./ci-tools/github-build/upload-image.sh $ARTIFACT_NAME

0 comments on commit 931914f

Please sign in to comment.