Merge pull request #31 from wejrox/Mounted-config-files-docker-compose
Mounted config files docker compose and sped up image build times
This commit is contained in:
@@ -1,3 +1,13 @@
|
|||||||
/docs
|
# Project administration files
|
||||||
/handbook
|
.idea
|
||||||
/tools
|
.git
|
||||||
|
.github
|
||||||
|
|
||||||
|
# Not used by the build.
|
||||||
|
docs
|
||||||
|
handbook
|
||||||
|
sql
|
||||||
|
tools
|
||||||
|
|
||||||
|
# Created by the db when using docker-compose, large and causes rebuild issues if sent to the context.
|
||||||
|
docker-db-data
|
||||||
|
|||||||
40
Dockerfile
40
Dockerfile
@@ -1,20 +1,42 @@
|
|||||||
# Initial Docker support thanks to xinyifly
|
# Initial Docker support thanks to xinyifly
|
||||||
|
# Optimisation performed by wejrox
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build stage
|
# Cosmic JAR creation stage
|
||||||
#
|
#
|
||||||
FROM maven:3.6.3-jdk-8 AS build
|
FROM maven:3.6.3-jdk-8 AS jar
|
||||||
COPY src /home/app/src
|
|
||||||
COPY pom.xml /home/app
|
# Build in a separated location which won't have permissions issues.
|
||||||
RUN mvn -f /home/app/pom.xml clean package
|
WORKDIR /opt/cosmic
|
||||||
|
# Any changes to the pom will affect the entire build, so it should be copied first.
|
||||||
|
COPY pom.xml ./pom.xml
|
||||||
|
# Grab all the dependencies listed in the pom early, since it prevents changes to source code from requiring a complete re-download.
|
||||||
|
# Skip compiling tests since we don't want all the dependecies to be downloaded.
|
||||||
|
RUN mvn -f ./pom.xml clean dependency:go-offline -Dmaven.test.skip -T 1C
|
||||||
|
# Source code changes may not change dependencies, so it can go last.
|
||||||
|
# Skip compiling tests since we don't want all the dependecies to be downloaded for plugins.
|
||||||
|
COPY src ./src
|
||||||
|
RUN mvn -f ./pom.xml clean package -Dmaven.test.skip -T 1C
|
||||||
|
|
||||||
#
|
#
|
||||||
# Package stage
|
# Server creation stage
|
||||||
#
|
#
|
||||||
FROM openjdk:8
|
FROM openjdk:8
|
||||||
COPY --from=build /home/app/target/Cosmic.jar /usr/local/lib/Cosmic.jar
|
|
||||||
COPY ./ ./
|
# Host the server in a location that won't have permissions issues.
|
||||||
|
WORKDIR /opt/server
|
||||||
|
# Copy the wizet files first since they're so big and won't change often.
|
||||||
|
COPY wz ./wz
|
||||||
|
# Copy the JAR we build earlier.
|
||||||
|
COPY --from=jar /opt/cosmic/target/Cosmic.jar ./Server.jar
|
||||||
|
# Scripts are sourced on server startup, so you can mount over them for quicker redeploy.
|
||||||
|
COPY scripts ./scripts/
|
||||||
|
# Config is read on server startup, so you can mount over it for quicker redeploy.
|
||||||
|
COPY config.yaml ./
|
||||||
|
# Default exposure, although not required if using docker compose.
|
||||||
|
# This exposes the login server, and channels.
|
||||||
|
# Format for channels: WWCC, where WW is 75 plus the world number and CC is 75 plus the channel number (both zero indexed).
|
||||||
EXPOSE 8484 7575 7576 7577
|
EXPOSE 8484 7575 7576 7577
|
||||||
ENTRYPOINT ["java", "-jar", "/usr/local/lib/Cosmic.jar"]
|
ENTRYPOINT ["java", "-jar", "./Server.jar"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,18 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
ports:
|
ports:
|
||||||
|
# Login server
|
||||||
- "8484:8484"
|
- "8484:8484"
|
||||||
|
# Channels.
|
||||||
|
# Format: WWCC, where WW is 75 plus the world number and CC is 75 plus the channel number (both zero indexed).
|
||||||
|
# In this case, world 1 channels 1-3.
|
||||||
- "7575-7577:7575-7577"
|
- "7575-7577:7575-7577"
|
||||||
|
volumes:
|
||||||
|
# Config changes can be reloaded without rebuilding the image.
|
||||||
|
# Still requires a redeployment as they're sourced on startup.
|
||||||
|
- ./config.yaml:/opt/server/config.yaml
|
||||||
|
- ./scripts:/opt/server/scripts
|
||||||
|
- ./wz:/opt/server/wz
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: "db"
|
DB_HOST: "db"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user