permissions failing when tosca parsing
[externalapi/nbi.git] / Dockerfile
1 #
2 #     Copyright (c) 2018 Orange
3 #
4 #     Licensed under the Apache License, Version 2.0 (the "License");
5 #     you may not use this file except in compliance with the License.
6 #     You may obtain a copy of the License at
7 #
8 #         http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #     Unless required by applicable law or agreed to in writing, software
11 #     distributed under the License is distributed on an "AS IS" BASIS,
12 #     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #     See the License for the specific language governing permissions and
14 #     limitations under the License.
15 #
16
17 FROM openjdk:8-jre-alpine
18
19 ARG SERVER_PORT
20 ARG PKG_FILENAME=nbi-rest-services-4.0.0.jar
21 ADD target/$PKG_FILENAME app.jar
22
23 RUN addgroup -S appgroup
24 RUN adduser -S appuser -G appgroup
25 RUN mkdir temptoscafile
26 RUN chown appuser:appgroup temptoscafile/
27
28 COPY src/main/resources/certificate /certs
29 ARG CERT_PASS=changeit
30 RUN for cert in $(ls -d /certs/*); do \
31         echo "adding $cert to java keystore..."; \
32         keytool -import \
33                 -file "$cert" \
34                 -storepass "${CERT_PASS}" \
35                 -keystore $JAVA_HOME/lib/security/cacerts \
36                 -alias "$(basename $cert)" \
37                 --noprompt; \
38     done
39
40 USER appuser:appgroup
41
42 ENV SERVER_PORT=${SERVER_PORT:-8080}
43 ENV JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom"
44
45 EXPOSE $SERVER_PORT
46 ENTRYPOINT java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap $JAVA_OPTS -jar /app.jar