Skip to content

Commit 477780a

Browse files
committed
OK-735: Build and deploy docker container
1 parent 8b22f82 commit 477780a

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515

16+
- uses: actions/cache@v4
17+
id: restore-build
18+
with:
19+
path: |
20+
ovara-backend/target
21+
key: ${{ github.sha }}
22+
1623
- name: Cache local Maven repository
1724
uses: actions/cache@v4
1825
with:
@@ -39,3 +46,38 @@ jobs:
3946
run: |
4047
cd ovara-backend
4148
mvn clean package -B -DskipTests
49+
50+
deploy-container:
51+
needs: build
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- uses: actions/checkout@v2
56+
57+
- uses: actions/cache@v4
58+
id: restore-build
59+
with:
60+
path: |
61+
ovara-backend/target
62+
key: ${{ github.sha }}
63+
64+
- name: Build and deploy Docker container
65+
shell: bash
66+
env:
67+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
68+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
69+
run: |
70+
set -euo pipefail
71+
git clone https://github.com/Opetushallitus/ci-tools.git
72+
source ci-tools/common/setup-tools.sh
73+
export ARTIFACT_NAME="ovara-backend"
74+
export BASE_IMAGE="baseimage-fatjar-openjdk21:master"
75+
source ci-tools/common/setup-tools.sh
76+
printf "HELLO\n"
77+
ls ovara-backend
78+
env
79+
mv ovara-backend/target/ovara-backend-*.jar $DOCKER_BUILD_DIR/artifact/${ARTIFACT_NAME}.jar
80+
cp -vr ovara-backend/src/main/resources/application.properties $DOCKER_BUILD_DIR/config/
81+
./ci-tools/common/pull-image.sh
82+
./ci-tools/github-build/build-fatjar.sh $ARTIFACT_NAME
83+
./ci-tools/github-build/upload-image.sh $ARTIFACT_NAME

0 commit comments

Comments
 (0)