blob: 4dd4a46f9fac145ed0c6ec439ceed3a548e86fa1 [file] [log] [blame]
elinuxhenrik93c5a6a2022-04-04 15:47:19 +02001#
2# ============LICENSE_START=======================================================
3# Copyright (C) 2020 Nordix Foundation.
4# ================================================================================
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# SPDX-License-Identifier: Apache-2.0
18# ============LICENSE_END=========================================================
19#
BjornMagnussonXA3e8977e2023-03-10 16:30:41 +010020FROM openjdk:17-jdk as jre-build
21
22RUN $JAVA_HOME/bin/jlink \
23--verbose \
24--add-modules ALL-MODULE-PATH \
25--strip-debug \
26--no-man-pages \
27--no-header-files \
28--compress=2 \
29--output /customjre
30
31# Use debian base image (same as openjdk uses)
32FROM debian:11-slim
33
34ENV JAVA_HOME=/jre
35ENV PATH="${JAVA_HOME}/bin:${PATH}"
36
37#copy JRE from the base image
38COPY --from=jre-build /customjre $JAVA_HOME
elinuxhenrik93c5a6a2022-04-04 15:47:19 +020039
40ARG JAR
41
42WORKDIR /opt/app/information-coordinator-service
43RUN mkdir -p /var/log/information-coordinator-service
44RUN mkdir -p /opt/app/information-coordinator-service/etc/cert/
45RUN mkdir -p /var/information-coordinator-service
46
47EXPOSE 8083 8434
48
49ADD /config/application.yaml /opt/app/information-coordinator-service/config/application.yaml
50ADD target/${JAR} /opt/app/information-coordinator-service/information-coordinator-service.jar
51ADD /config/keystore.jks /opt/app/information-coordinator-service/etc/cert/keystore.jks
52ADD /config/truststore.jks /opt/app/information-coordinator-service/etc/cert/truststore.jks
53
54ARG user=nonrtric
55ARG group=nonrtric
56
57RUN groupadd $user && \
58 useradd -r -g $group $user
59RUN chown -R $user:$group /opt/app/information-coordinator-service
60RUN chown -R $user:$group /var/log/information-coordinator-service
61RUN chown -R $user:$group /var/information-coordinator-service
62
63USER ${user}
64
BjornMagnussonXA3e8977e2023-03-10 16:30:41 +010065CMD ["/jre/bin/java", "-jar", "/opt/app/information-coordinator-service/information-coordinator-service.jar"]
elinuxhenrik93c5a6a2022-04-04 15:47:19 +020066
67
68
69