-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile-local
57 lines (43 loc) · 2.15 KB
/
Dockerfile-local
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
FROM adoptopenjdk/openjdk11:alpine-slim AS overlay
RUN mkdir -p cas-overlay
COPY ./src cas-overlay/src/
COPY ./gradle/ cas-overlay/gradle/
COPY ./gradlew ./settings.gradle ./build.gradle ./gradle.properties /cas-overlay/
RUN mkdir -p ~/.gradle \
&& echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties \
&& echo "org.gradle.configureondemand=true" >> ~/.gradle/gradle.properties \
&& cd cas-overlay \
&& chmod 750 ./gradlew \
&& ./gradlew --version;
RUN cd cas-overlay && ./gradlew clean build --parallel --no-daemon;
# The build process above in docker may take a long time depending on your local resources. This OK if you only use
# CAS by building it once. For local development, building in local shell or with your IDE such as IntelliJ is much
# faster. Afterwards, simply comment out the above "RUN" command above and enable the "COPY" one below.
# COPY ./build cas-overlay/build/
# In fact, the above "overlay" stage can be skipped if you have the WAR built locally. Simply run this second stage
# "cas" with a modified WAR source.
FROM adoptopenjdk/openjdk11:alpine-jre AS cas
LABEL "Organization"="Center for Open Science"
LABEL "Description"="OSF CAS"
RUN cd / \
&& mkdir -p /etc/cas/config \
&& mkdir -p /etc/cas/services \
&& mkdir -p /etc/cas/saml \
&& mkdir -p cas-overlay;
COPY etc/cas/ /etc/cas/
COPY etc/cas/config/ /etc/cas/config/
# Use "cas-local.properties", "instn-authn-local.xsl" and "log4j2-local.xml" for local development
COPY etc/cas/config/local/cas-local.properties etc/cas/config/cas.properties
COPY etc/cas/config/local/instn-authn-local.xsl etc/cas/config/instn-authn.xsl
COPY etc/cas/config/local/log4j2-local.xml etc/cas/config/log4j2.xml
RUN rm -r etc/cas/config/local
COPY etc/cas/services/ /etc/cas/services/
# Use registered services defined in "local/services" for local development
COPY etc/cas/services/local/* /etc/cas/services/
RUN rm -r etc/cas/services/local/
COPY etc/cas/saml/ /etc/cas/saml/
COPY --from=overlay cas-overlay/build/libs/cas.war cas-overlay/
EXPOSE 8080
ENV PATH $PATH:$JAVA_HOME/bin:.
WORKDIR cas-overlay
ENTRYPOINT ["java", "-server", "-noverify", "-Xmx2048M", "-jar", "cas.war"]