forked from RetailMeNotSandbox/hydra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (46 loc) · 1.58 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
#########################################
# Builder image
#########################################
FROM openjdk:8 as builder
LABEL authors=RetailMeNot
RUN apt-get update && \
apt-get -y install apt-transport-https && \
echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 && \
apt-get update && \
apt-get -y install \
sbt \
gzip \
libc6 \
tar \
zip \
&& \
# make sbt use shared directories, so we can easily specify a different user to run the container
mkdir /etc/ivy && \
chmod -R 0777 /etc/sbt /etc/ivy && \
echo "-sbt-dir /etc/sbt" >> /etc/sbt/sbtopts && \
echo "-sbt-boot /etc/sbt/boot" >> /etc/sbt/sbtopts && \
echo "-ivy /etc/ivy" >> /etc/sbt/sbtopts && \
echo "-no-colors" >> /etc/sbt/sbtopts
WORKDIR /hydra
# fetch dependencies ahead of time –– that way simple code changes should be cache hits
COPY build.sbt /hydra
COPY project /hydra/project
RUN sbt update
COPY . /hydra
RUN sbt clean test && \
sbt universal:packageBin && \
mkdir -p /opt/hydra && \
unzip target/universal/hydra-*.zip -d /opt && \
mv /opt/hydra-*/* /opt/hydra/
#########################################
# Runtime image
#########################################
FROM adoptopenjdk/openjdk11:alpine-slim
LABEL authors=RetailMeNot
RUN apk update && \
apk upgrade && \
apk add bash
COPY --from=builder /opt/hydra/ /opt/hydra
EXPOSE 9000
CMD ["/opt/hydra/bin/hydra"]