-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
136 lines (103 loc) · 6.21 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
FROM ubuntu:20.04 AS BUILD_IMAGE
MAINTAINER Rodney Lai <rlai@irismedia.com>
ENV ACTIVATOR_VERSION 1.3.6
ENV SBT_VERSION 1.3.13
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get upgrade -y -q
RUN apt-get install -y wget
RUN apt-get install -y unzip
RUN apt-get install -y openjdk-8-jre-headless
RUN apt-get install -y openjdk-8-jdk
RUN apt-get install -y scala
RUN update-ca-certificates -f
RUN useradd -ms /bin/bash deploy-user
USER deploy-user
RUN mkdir /home/deploy-user/tmp && \
cd /home/deploy-user/tmp && \
wget http://downloads.typesafe.com/typesafe-activator/$ACTIVATOR_VERSION/typesafe-activator-$ACTIVATOR_VERSION.zip && \
unzip typesafe-activator-$ACTIVATOR_VERSION.zip -d /home/deploy-user && \
mv /home/deploy-user/activator-dist-$ACTIVATOR_VERSION /home/deploy-user/activator && \
rm typesafe-activator-$ACTIVATOR_VERSION.zip && \
cd /home/deploy-user && \
rm -rf /home/deploy-user/tmp
RUN mkdir /home/deploy-user/tmp && \
cd /home/deploy-user/tmp && \
wget https://github.com/sbt/sbt/releases/download/v$SBT_VERSION/sbt-$SBT_VERSION.zip && \
unzip sbt-$SBT_VERSION.zip -d /home/deploy-user && \
cd /home/deploy-user && \
rm -rf /home/deploy-user/tmp
ADD lib /home/deploy-user/root/build/lib
ADD home/app /home/deploy-user/root/build/home/app
ADD home/test /home/deploy-user/root/build/home/test
ADD home/conf /home/deploy-user/root/build/home/conf
ADD home/public /home/deploy-user/root/build/home/public
ADD home/build.sbt /home/deploy-user/root/build/home/
ADD home/README /home/deploy-user/root/build/home/
ADD home/project/plugins.sbt /home/deploy-user/root/build/home/project/
ADD home/project/build.properties /home/deploy-user/root/build/home/project/
ADD upload/app /home/deploy-user/root/build/upload/app
ADD upload/test /home/deploy-user/root/build/upload/test
ADD upload/conf /home/deploy-user/root/build/upload/conf
ADD upload/public /home/deploy-user/root/build/upload/public
ADD upload/build.sbt /home/deploy-user/root/build/upload/
ADD upload/project/plugins.sbt /home/deploy-user/root/build/upload/project/
ADD upload/project/build.properties /home/deploy-user/root/build/upload/project/
ADD emailer/src /home/deploy-user/root/build/emailer/src
ADD emailer/build.sbt /home/deploy-user/root/build/emailer/
ADD emailer/project/build.properties /home/deploy-user/root/build/emailer/project/
ADD emailer/project/assembly.sbt /home/deploy-user/root/build/emailer/project/
ADD api /home/deploy-user/root/build/api
RUN cp -r /home/deploy-user/root/build/ /home/deploy-user
USER root
RUN rm -rf /home/deploy-user/root
USER deploy-user
RUN cd /home/deploy-user/build/home; /home/deploy-user/activator/activator test stage
RUN rm /home/deploy-user/build/home/target/universal/stage/bin/*.bat
RUN mv /home/deploy-user/build/home/target/universal/stage /home/deploy-user/deploy-home
RUN cd /home/deploy-user/build/upload; /home/deploy-user/sbt/bin/sbt test stage
RUN rm /home/deploy-user/build/upload/target/universal/stage/bin/*.bat
RUN mv /home/deploy-user/build/upload/target/universal/stage /home/deploy-user/deploy-upload
RUN cd /home/deploy-user/build/emailer; /home/deploy-user/sbt/bin/sbt assembly
RUN mkdir /home/deploy-user/deploy-emailer
RUN mv /home/deploy-user/build/emailer/target/scala-2.13/*.jar /home/deploy-user/deploy-emailer
RUN cd /home/deploy-user/build/api; /home/deploy-user/sbt/bin/sbt assembly
RUN mkdir /home/deploy-user/deploy-api
RUN mv /home/deploy-user/build/api/target/scala-2.13/*.jar /home/deploy-user/deploy-api
RUN mkdir /home/deploy-user/deploy-api/files
RUN mv /home/deploy-user/build/api/README.md /home/deploy-user/deploy-api/files/README.md
RUN rm -rf /home/deploy-user/build
FROM ubuntu:20.04
MAINTAINER Rodney Lai <rlai@irismedia.com>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get upgrade -y -q
RUN apt-get install -y openjdk-8-jre-headless
RUN apt-get install -y scala
RUN useradd -ms /bin/bash deploy-user
USER deploy-user
COPY --from=BUILD_IMAGE --chown=deploy-user:deploy-user /home/deploy-user/deploy-home /home/deploy-user/deploy-home
COPY --from=BUILD_IMAGE --chown=deploy-user:deploy-user /home/deploy-user/deploy-upload /home/deploy-user/deploy-upload
COPY --from=BUILD_IMAGE --chown=deploy-user:deploy-user /home/deploy-user/deploy-emailer /home/deploy-user/deploy-emailer
COPY --from=BUILD_IMAGE --chown=deploy-user:deploy-user /home/deploy-user/deploy-api /home/deploy-user/deploy-api
RUN date > /home/deploy-user/deploy-home/BUILD_DATE
RUN date > /home/deploy-user/deploy-upload/BUILD_DATE
RUN date > /home/deploy-user/deploy-emailer/BUILD_DATE
RUN date > /home/deploy-user/deploy-api/BUILD_DATE
RUN echo -n "#!/usr/bin/scala " > /home/deploy-user/deploy-emailer/emailer
RUN ls /home/deploy-user/deploy-emailer/emailer*.jar >> /home/deploy-user/deploy-emailer/emailer
RUN chmod 755 /home/deploy-user/deploy-emailer/emailer
RUN echo -n "#!/usr/bin/scala " > /home/deploy-user/deploy-api/api
RUN ls /home/deploy-user/deploy-api/test-api*.jar >> /home/deploy-user/deploy-api/api
RUN chmod 755 /home/deploy-user/deploy-api/api
RUN ls -la /home/deploy-user
RUN ls -la /home/deploy-user/deploy-home
RUN ls -la /home/deploy-user/deploy-home/bin
RUN ls -la /home/deploy-user/deploy-upload
RUN ls -la /home/deploy-user/deploy-upload/bin
RUN ls -la /home/deploy-user/deploy-emailer
RUN ls -la /home/deploy-user/deploy-api
RUN ls -la /home/deploy-user/deploy-api/files
WORKDIR /home/deploy-user/deploy-home/bin
ENTRYPOINT ["./rodney-test-site-home","-Dhttps.port=9443"]
EXPOSE 9000 9443 8088