-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
134 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea | ||
*.iml | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const httpPort = 3000 | ||
export const csrfCookieName = 'XSRF-TOKEN' | ||
export const serviceUrl = 'http://localhost:8080' | ||
export const serviceUrl = process.env.SERVICE_URL || 'http://localhost:8080' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: '3.5' | ||
|
||
services: | ||
service: | ||
build: | ||
context: ../service/ | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
JAVA_OPTS: -server -Djava.security.egd=file:/dev/./urandom -Xms1024m -Xss512k -Xmx1024m -XX:TieredStopAtLevel=1 | ||
SPRING_DATASOURCE_URL: jdbc:postgresql://oppivelvollisuus-db:5432/oppivelvollisuus | ||
SPRING_DATASOURCE_USERNAME: oppivelvollisuus | ||
SPRING_DATASOURCE_PASSWORD: postgres | ||
|
||
api-gateway: | ||
build: | ||
context: ../api-gateway/ | ||
ports: | ||
- "3000:3000" | ||
environment: | ||
SERVICE_URL: "http://service:8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM eclipse-temurin:17-jammy as base | ||
|
||
LABEL maintainer="https://github.com/espoon-voltti/oppivelvollisuus" | ||
|
||
ENV LC_ALL C.UTF-8 | ||
ENV LANG C.UTF-8 | ||
ENV LANGUAGE C.UTF-8 | ||
RUN apt-get update \ | ||
&& apt-get -y dist-upgrade \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
tzdata \ | ||
ca-certificates \ | ||
curl \ | ||
unzip \ | ||
&& ln -fs /usr/share/zoneinfo/Europe/Helsinki /etc/localtime \ | ||
&& dpkg-reconfigure --frontend noninteractive tzdata \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
FROM base as builder | ||
|
||
WORKDIR /app | ||
|
||
COPY ./gradle/ ./gradle/ | ||
COPY ./gradlew ./build.gradle.kts ./gradle.properties ./settings.gradle.kts ./ | ||
|
||
RUN ./gradlew --no-daemon resolveDependencies | ||
|
||
COPY . . | ||
|
||
# --offline is used to be sure that all dependencies are installed in previous steps | ||
RUN ./gradlew --offline --no-daemon assemble \ | ||
&& unzip -oq build/libs/oppivelvollisuus-service-boot.jar -d target | ||
|
||
FROM base | ||
|
||
WORKDIR /app | ||
|
||
COPY ./entrypoint.sh entrypoint.sh | ||
ENTRYPOINT ["./entrypoint.sh"] | ||
|
||
ENV USERNAME oppivelvollisuus | ||
ENV HOME_DIR /home/${USERNAME} | ||
ENV USER_ID 1000 | ||
|
||
RUN adduser ${USERNAME} --gecos "" -q --home ${HOME_DIR} --uid ${USER_ID} --disabled-password | ||
|
||
COPY --from=builder /app/target/ . | ||
|
||
USER ${USERNAME} | ||
|
||
ARG build=none | ||
ARG commit=none | ||
ENV APP_BUILD "$build" | ||
ENV APP_COMMIT "$commit" | ||
LABEL fi.espoo.build="$build" \ | ||
fi.espoo.commit="$commit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# For log tagging (with a default value and error logging without crashing) | ||
# shellcheck disable=SC2155 | ||
export HOST_IP=$(curl --silent --fail --show-error http://169.254.169.254/latest/meta-data/local-ipv4 || printf 'UNAVAILABLE') | ||
|
||
# shellcheck disable=SC2086 | ||
exec java -cp . -server $JAVA_OPTS org.springframework.boot.loader.JarLauncher "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | ||
org.gradle.vfs.watch=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
rootProject.name = "oppivelvollisuus" | ||
rootProject.name = "oppivelvollisuus-service" | ||
|
||
dependencyResolutionManagement { | ||
repositories { | ||
mavenCentral() | ||
maven("https://build.shibboleth.net/maven/releases") { | ||
content { | ||
includeGroup("net.shibboleth") | ||
includeGroup("net.shibboleth.utilities") | ||
includeGroup("org.opensaml") | ||
} | ||
} | ||
} | ||
} |