Remove force update and ca-certificates
[aai/aai-service.git] / ajsc-aai / src / main / resources / docker / Dockerfile
1 FROM ubuntu:14.04
2
3 ENV HTTP_PROXY ${HTTP_PROXY}
4
5 RUN if [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::proxy  \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; fi
6 RUN if [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::https::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; fi
7
8 ENV DEBIAN_FRONTEND noninteractive
9
10 ENV HTTP_PROXY  ${HTTP_PROXY}
11 ENV HTTPS_PROXY ${HTTP_PROXY}
12 ENV https_proxy ${HTTP_PROXY}
13 ENV http_proxy  ${HTTP_PROXY}
14
15 RUN apt-get update && apt-get install -y software-properties-common
16
17 # sudo -E is required to preserve the environment
18 # If you remove that line, it will most like freeze at this step
19
20 RUN apt-get install --reinstall ca-certificates && sudo -E add-apt-repository ppa:openjdk-r/ppa && \
21     apt-get update && \
22     apt-get -qq install -y openjdk-8-jre-headless git curl ksh
23
24 # Setup JAVA_HOME, this is useful for docker commandline
25 ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
26
27 # Install Chef
28 RUN curl -LO  https://packages.chef.io/stable/ubuntu/14.04/chefdk_0.17.17-1_amd64.deb
29 RUN dpkg -i chefdk_0.17.17-1_amd64.deb 
30 RUN rm chefdk_0.17.17-1_amd64.deb 
31
32 # Add the application folder and common libs to /opt inside container
33 # Add the chef script and startup script to docker container
34 # Change the permissions to enable execute access
35
36 ADD ./opt/app /opt/app
37 ADD ./commonLibs/ /opt/app/commonLibs/
38
39 ADD init-chef.sh /init-chef.sh
40 ADD startup.sh /startup.sh
41 ADD aai.sh /etc/profile.d/aai.sh
42
43 RUN chmod 755 /init-chef.sh /startup.sh
44 RUN chmod 644 /etc/profile.d/aai.sh
45
46 # When the container is started this is the entrypoint script
47 # that docker will run. Make sure this script doesn't end abruptly
48 # If you want the container running even if the main application stops
49 # You can run a ever lasting process like tail -f /dev/null
50 # Or something like that at the end of the startup script
51 # So if the main application you are planning on running fails
52 # the docker container keeps on running forever
53
54 ENTRYPOINT ./startup.sh
55
56 # Expose the ports for outside linux to use
57 # 8443 is the important one to be used
58
59 EXPOSE 8443
60 EXPOSE 8080
61
62 # Create the directory structure of aai application resembling the development server
63 # hard-coding path to match ajsc version
64
65 RUN mkdir /opt/aaihome && \
66     useradd -ms /bin/bash -d /opt/aaihome/aaiadmin aaiadmin && \
67     ln -s /opt/app/${project.artifactId}/${project.version}  /opt/app/aai && \
68     chown aaiadmin:aaiadmin /opt/app/aai && \
69     chown -R aaiadmin:aaiadmin /opt/app/${project.artifactId}/${project.version} && \
70     mkdir -p /opt/aai/logroot && \
71     chown -R aaiadmin:aaiadmin /opt/aai/logroot && \
72     ln -s /opt/app/aai/bin scripts && \
73     mkdir /opt/app/aai/extApps && chown -R aaiadmin:aaiadmin /opt/app/aai/extApps && \
74     find /opt/app/aai/bin -name "*.sh" -exec chmod 755 {} +
75
76 WORKDIR /var/chef
77
78 RUN chown aaiadmin:aaiadmin /startup.sh && \
79     chown -R aaiadmin:aaiadmin /var/chef 
80
81 RUN mkdir /opt/aai/logroot/AAI && chown aaiadmin:aaiadmin /opt/aai/logroot/AAI
82 VOLUME /opt/aai/logroot/AAI 
83
84 WORKDIR /
85
86 USER aaiadmin