Skip to content

Logbackin konffi

Logbackin konffi #68

name: Build Lampi-siirtäjä Container
on:
workflow_dispatch:
push:
paths:
- '.github/workflows/build-lampi-siirtaja.yml'
- 'lampi-siirtaja-container/**'
permissions:
id-token: write
contents: read
jobs:
build-and-deploy-container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Europe/Helsinki"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_OVARA_UTILITY_ROLE_ARN }}
role-session-name: ovara-lampi-siirtaja-ecr-push
aws-region: eu-west-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ovara-lampi-siirtaja
IMAGE_TAG: ga-${{ github.run_number }}
run: |
cd lampi-siirtaja-container
cd lampi-siirtaja
mvn -B clean spotless:check package
cd -
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG