1 # Copyright 2020 Huawei Technologies Co., Ltd.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # FROM swr.ap-southeast-1.myhuaweicloud.com/edgegallery/openjdk:8u201-jdk-alpine
17 # currently this pod is running as root user due to this need to communicate with host shell.config
18 # in future this can be further checked with adding some level restrictions to user
19 FROM openjdk:11-jre-slim
21 ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64/bin/java
23 ENV APP_FILE backup.jar
26 # Create the home directory for the new app user.
28 RUN mkdir -p /usr/app/bin
30 # Create an app user so our program doesn't run as root.
31 RUN apt-get update && apt-get install -y sshpass
35 RUN chmod 750 $APP_HOME &&\
36 chmod -R 550 $APP_HOME/bin &&\
37 mkdir -p -m 750 $APP_HOME/config &&\
38 mkdir -p -m 750 $APP_HOME/log &&\
39 mkdir -p -m 750 $APP_HOME/packages &&\
40 mkdir -p -m 700 $APP_HOME/ssl &&\
41 mkdir -p -m 700 $APP_HOME/.kube
43 COPY /target/*.jar $APP_HOME/bin
47 # Change to the app user.
49 # Execute script & application
50 ENTRYPOINT ["sh", "-c"]
51 CMD ["exec java -jar ./bin/backup.jar"]