Skip to content

Commit

Permalink
👷 Tester distroless
Browse files Browse the repository at this point in the history
  • Loading branch information
havstein committed Nov 4, 2023
1 parent c470b24 commit d2a9c78
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 4 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/teste-distroless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: teste distroless

on:
push:
paths-ignore:
- 'Dockerfile-opprydding-dev'
- 'spesialist-opprydding-dev/**'
- '.github/workflows/spesialist-opprydding-dev.yml'
- 'deploy/dev-opprydding.yml'
- 'Dockerfile-migrering'
- 'spesialist-migrering/**'
- '.github/workflows/spesialist-migrering.yml'
- 'deploy/dev-migrering.yml'
- 'deploy/prod-migrering.yml'
- '.github/workflows/deploy_specific_commit_to_dev.yml'
branches:
- teste-distroless

jobs:
build:
permissions:
contents: "read"
id-token: "write"
name: Build image
runs-on: ubuntu-latest-16-cores
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17.x'

- name: Gradle build
uses: gradle/[email protected]
with:
arguments: :spesialist-selve:build # felles- og api-modulene bygges fordi selve avhenger av dem
env:
ORG_GRADLE_PROJECT_githubUser: x-access-token
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}

- uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: tbd
cache_from: type=gha
cache_to: type=gha,mode=min
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
outputs:
image: ${{ steps.docker-build-push.outputs.image }}

deployDev:
name: Deploy to dev
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: deploy/dev.yml,deploy/dev-db-policy.yml
IMAGE: ${{ needs.build.outputs.image }}
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
FROM ghcr.io/navikt/baseimages/temurin:17
FROM gcr.io/distroless/java17@sha256:052076466984fd56979c15a9c3b7433262b0ad9aae55bc0c53d1da8ffdd829c3

COPY spesialist-selve/build/deps/*.jar ./
COPY spesialist-selve/build/libs/*.jar ./
ENV LANG="nb_NO.UTF-8" LC_ALL="nb_NO.UTF-8" TZ="Europe/Oslo" JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"

ENV JAVA_OPTS="-XX:MaxRAMPercentage=90 -XX:ActiveProcessorCount=2"
WORKDIR app

COPY spesialist-selve/build/deps/*.jar /app/
COPY spesialist-selve/build/libs/*.jar /app/

CMD ["app.jar"]
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ private val sikkerlogg = LoggerFactory.getLogger("tjenestekall")
private val personIdRegex = "\\d{11,13}".toRegex()

internal class ApplicationBuilder(env: Map<String, String>) : RapidsConnection.StatusListener {
init {
println("file.encoding=" + System.getProperty("file.encoding"))
println("java.version=" + System.getProperty("java.version"))
println("LANG=" + System.getenv("LANG"))
println("LC_ALL=" + System.getenv("LC_ALL"))
println("Noen problematiske tegn:")
println("ø")
println("\u65E5")
}
private val dataSourceBuilder = DataSourceBuilder(env)
private val dataSource = dataSourceBuilder.getDataSource()

Expand Down

0 comments on commit d2a9c78

Please sign in to comment.