-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update dockerfile to jdk8 and cleanup build #390
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ _site | |
target | ||
support | ||
vendor | ||
project/target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,28 @@ | ||
FROM java:7 | ||
FROM java:8-jdk | ||
MAINTAINER Gabe Conradi <[email protected]> | ||
|
||
RUN apt-get update && apt-get install -y zip unzip && rm -r /var/lib/apt/lists/* | ||
|
||
RUN useradd -Ur -d /opt/collins collins | ||
RUN for dir in /build /build/collins /var/log/collins /var/run/collins; do mkdir $dir; chown collins $dir; done | ||
ENV ACTIVATOR_VERSION 1.3.7 | ||
|
||
WORKDIR /build | ||
# get Play, Collins, build, and deploy it to /opt/collins | ||
COPY . /build/collins | ||
RUN wget -q http://downloads.typesafe.com/typesafe-activator/1.3.6/typesafe-activator-1.3.6-minimal.zip -O /build/typesafe-activator-1.3.6-minimal.zip && \ | ||
unzip -q ./typesafe-activator-1.3.6-minimal.zip && \ | ||
RUN cd /build && \ | ||
wget -q http://downloads.typesafe.com/typesafe-activator/$ACTIVATOR_VERSION/typesafe-activator-$ACTIVATOR_VERSION-minimal.zip -O /build/activator.zip && \ | ||
unzip -q ./activator.zip && \ | ||
cd collins && \ | ||
java -version 2>&1 && \ | ||
PLAY_CMD=/build/activator-1.3.6-minimal/activator ./scripts/package.sh && \ | ||
PLAY_CMD=/build/activator-$ACTIVATOR_VERSION-minimal/activator ./scripts/package.sh && \ | ||
unzip -q /build/collins/target/collins.zip -d /opt/ && \ | ||
cd / && rm -rf /build && \ | ||
chown -R collins /opt/collins | ||
cd / && rm -rf /build | ||
|
||
# Add in all the default configs we want in this build so collins can run. | ||
# Override /opt/collins/conf with your own configs with -v | ||
COPY conf/docker/validations.conf /opt/collins/conf/validations.conf | ||
COPY conf/docker/authentication.conf /opt/collins/conf/authentication.conf | ||
COPY conf/docker/database.conf /opt/collins/conf/database.conf | ||
COPY conf/docker/production.conf /opt/collins/conf/production.conf | ||
COPY conf/docker/users.conf /opt/collins/conf/users.conf | ||
COPY conf/docker/profiles.yaml /opt/collins/conf/profiles.yaml | ||
COPY conf/docker/permissions.yaml /opt/collins/conf/permissions.yaml | ||
COPY conf/docker/logger.xml /opt/collins/conf/logger.xml | ||
WORKDIR /opt/collins | ||
|
||
RUN chown -R collins /opt/collins | ||
# Add in all the default configs we want in this build so collins can run. | ||
# You probably will want to override these configs in production | ||
COPY conf/docker conf/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you want to copy or mount this to allow easy updating of the configs (e.g. via puppet) without rebuilding the container? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Configs can be overridden at runtime. This just places the default configs in the correct place to enable config-less startup. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it the best practice to make the user-configurable storage a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For storage, yes. These are just configs though (i.e. the app isnt persisting any state into this directory). The user could totally allocate a volume for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed that a set of default configs should be baked into the image. It would be nice to expose the user-serviceable configs by adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That will not work. That will tell docker to allocate a volume at runtime always, making our default configs inaccessible (shadowed). This works as it is written, and will allow users to provide their own configs as necessary (via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it would copy the files into the volume. But since it doesn't work like that, working code is good. 👍 |
||
|
||
WORKDIR /opt/collins | ||
USER collins | ||
EXPOSE 9000 | ||
EXPOSE 3333 | ||
CMD ["/usr/bin/java","-server","-Dconfig.file=/opt/collins/conf/production.conf","-Dhttp.port=9000","-Dlogger.file=/opt/collins/conf/logger.xml","-Dnetworkaddress.cache.ttl=1","-Dnetworkaddress.cache.negative.ttl=1","-Dcom.sun.management.jmxremote","-Dcom.sun.management.jmxremote.port=3333","-Dcom.sun.management.jmxremote.authenticate=false","-Dcom.sun.management.jmxremote.ssl=false","-XX:MaxPermSize=384m","-XX:+CMSClassUnloadingEnabled","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-XX:+PrintTenuringDistribution","-XX:+PrintHeapAtGC","-Xloggc:/var/log/collins/gc.log","-XX:+UseGCLogFileRotation","-cp","/opt/collins/lib/*","play.core.server.NettyServer","/opt/collins"] | ||
# expose HTTP, JMX | ||
EXPOSE 9000 3333 | ||
CMD ["/usr/bin/java","-server","-Dconfig.file=/opt/collins/conf/production.conf","-Dhttp.port=9000","-Dlogger.file=/opt/collins/conf/logger.xml","-Dnetworkaddress.cache.ttl=1","-Dnetworkaddress.cache.negative.ttl=1","-Dcom.sun.management.jmxremote","-Dcom.sun.management.jmxremote.port=3333","-Dcom.sun.management.jmxremote.authenticate=false","-Dcom.sun.management.jmxremote.ssl=false","-XX:MaxPermSize=384m","-XX:+CMSClassUnloadingEnabled","-cp","/opt/collins/lib/*","play.core.server.NettyServer","/opt/collins"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can this extremely long line be split to multiple lines please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, actually. Dockerfile syntax requires it is on one line :( |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels a little off to have this env var sitting around, since it's not used for anything except building the container. What about moving it to the top of the
RUN
section, rather than having it as a globalENV
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM