forked from SpongePowered/Ore
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
46 lines (34 loc) · 1.78 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
# This Dockerfile is designed to be used for production
FROM openjdk:8-jdk-alpine
LABEL maintainer="Lobo Metalúrgico <[email protected]>"
# Temporary build folder for the 'stage' task
WORKDIR /home/ore/build
# The .dockerignore file on the project root avoids build cache and personal configuration to be included in the image
ADD . ./
# TODO use Docker secrets for the app key and passwords (and any other sensible information)
ENV SBT_VERSION=1.4.0 \
SBT_HOME=/usr/local/sbt \
SBT_OPTS="-Xss4m -Xms2048m -Xmx2048m -XX:ReservedCodeCacheSize=256m -XX:MaxMetaspaceSize=512m"
ENV PATH=${PATH}:${SBT_HOME}/bin
# TODO a shell script to extract the SBT version from project/build.properties and set SBT_VERSION to the output value
RUN cp ore/conf/ore-default-settings.conf.template ore/conf/ore-default-settings.conf && \
cp jobs/src/main/resources/ore-jobs-default-settings.conf.template jobs/src/main/resources/ore-jobs-default-settings.conf
RUN apk update && \
apk add --virtual --no-cache curl ca-certificates bash yarn
# Downloads SBT with the version given above and extracts it
RUN curl -sL "https://github.com/sbt/sbt/releases/download/v$SBT_VERSION/sbt-$SBT_VERSION.tgz" -o "sbt-$SBT_VERSION.tgz" && \
tar -xvzf "sbt-$SBT_VERSION.tgz" -C /usr/local
# Compiles Ore and makes a production distribution (but not in an archive, unlike 'dist')
RUN sbt stage
# Move the 'stage' task result _content_ into the production directory
RUN mkdir -p /home/ore/prod && \
mv /home/ore/build/ore/target/universal/stage/* /home/ore/prod && \
# Cleans the temporary build directory, as we don't need it in the final image
rm -rf /home/ore/build && \
# SBT is no longer needed too
rm -rf $SBT_HOME && \
apk del curl
WORKDIR /home/ore/prod/bin
# Ore runs on port 9000
EXPOSE 9000
CMD ["./ore"]