Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*

!app/

!conf/
# This is created in the Dockerfile
conf/application.conf

!OreTestPlugin/

!project/
project/target/
project/project/

!public/

!scripts/

!build.sbt
49 changes: 34 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,42 @@
# This Dockerfile is designed to be used for production
FROM openjdk:8-jdk-alpine

MAINTAINER Jadon Fowler <jadonflower@gmail.com>
LABEL maintainer="Jadon Fowler <jadonflower@gmail.com>"

# Install Activator
RUN apk update
RUN apk add curl unzip bash postgresql
RUN curl -O http://downloads.typesafe.com/typesafe-activator/1.3.6/typesafe-activator-1.3.6.zip
RUN unzip typesafe-activator-1.3.6.zip -d / && rm typesafe-activator-1.3.6.zip && chmod a+x /activator-dist-1.3.6/activator
ENV PATH $PATH:/activator-dist-1.3.6
# 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 . ./

# Copy Ore
RUN mkdir -p /home/play/ore/
WORKDIR /home/play/ore/
ADD . /home/play/ore/
# TODO use Docker secrets for the app key and passwords (and any other sensible information)
ENV SBT_VERSION=1.2.1 \
SBT_HOME=/usr/local/sbt \
JDBC_DATABASE_URL=jdbc:postgresql://db/ore \
SPONGE_AUTH_URL=http://spongeauth:8000 \
APPLICATION_SECRET="some_secret"

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 conf/application.conf conf/application.conf && \
apk add --virtual --no-cache curl ca-certificates bash && \
# Downloads SBT with the version given above and extracts it
curl -sL "https://piccolo.link/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')
sbt stage && \
mkdir -p /home/ore/prod && \
# Copy the 'stage' task result _content_ into the production directory
cp -r /home/ore/build/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
# 8888 is the Activator UI
EXPOSE 9000

RUN cp conf/application.conf.template conf/application.conf

CMD ["/home/play/ore/docker.sh"]
CMD ["./ore"]
3 changes: 3 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ resolvers ++= Seq(
"Akka Snapshot Repository" at "http://repo.akka.io/snapshots/"
)

sources in (Compile, doc) := Seq.empty
publishArtifact in (Compile, packageDoc) := false

libraryDependencies ++= Seq( ehcache , ws , specs2 % Test , guice )
libraryDependencies ++= Seq(
"org.spongepowered" % "play-discourse" % "3.0",
Expand Down
11 changes: 7 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
version: "2"
version: '3'

services:
app:
image: ore:1.6.8
build: .
depends_on:
- 'db'
- 'spongeauth'
ports:
- "9000:9000"
- '9000:9000'
stdin_open: true
db:
build: '.docker/db/'
restart: always
ports:
- '5432:5432'
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: ""
POSTGRES_PASSWORD: ''
POSTGRES_DB: ore
spongeauth:
image: spongepowered/spongeauth
depends_on:
- 'db'
ports:
- "8000:8000"
- '8000:8000'
3 changes: 2 additions & 1 deletion docker.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh

# This is probably not needed anymore
# We want to connect to db/ore
env JDBC_DATABASE_URL="jdbc:postgresql://db/ore" SPONGE_AUTH_URL="http://spongeauth:8000" activator run
JDBC_DATABASE_URL="jdbc:postgresql://db/ore" SPONGE_AUTH_URL="http://spongeauth:8000" java -jar