diff --git a/Dockerfile b/Dockerfile index 51b67b2..49285ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,15 +8,17 @@ RUN /install_deps.sh ### Basic settings for Eco Server WORKDIR /srv/eco-server EXPOSE 2999/udp 3000 3001 -VOLUME ["/srv/eco-server/Storage", "/srv/eco-server/Configs"] -CMD ["mono", "EcoServer.exe", "-nogui"] +CMD ["/srv/eco-server/start.sh"] -ARG ECO_FILENAME -LABEL eco.version="unknown" +ADD SHA256SUMS ./ -ADD ${ECO_SERVER_FILENAME} /tmp +ARG ECO_VERSION +ENV ECO_VERSION=${ECO_VERSION} +LABEL eco.version=${ECO_VERSION} ### Install Eco Server ADD install.sh ./ -RUN /srv/eco-server/install.sh ${ECO_FILENAME} +ADD start.sh ./ + +RUN /srv/eco-server/install.sh diff --git a/Makefile b/Makefile index 700f73c..51010b3 100644 --- a/Makefile +++ b/Makefile @@ -1,29 +1,21 @@ -ECO_VERSION ?= 0.7.1.2-beta -ECO_FILENAME = EcoServer_v${ECO_VERSION}.zip -ECO_SERVER_URL = https://s3-us-west-2.amazonaws.com/eco-releases/EcoServer_v${ECO_VERSION}.zip +ECO_VERSION ?= 0.7.2.3-beta DOCKER_IMAGE = t3hk0d3/eco-server DOCKER_TARGET = ${DOCKER_IMAGE}:${ECO_VERSION} all: build push clean -download: - if [ ! -f ${ECO_FILENAME} ]; then \ - curl -o "${ECO_FILENAME}" "${ECO_SERVER_URL}"; \ - fi; - -verify: download - shasum -a 256 -c SHA256SUMS - -build: verify +build: docker build --rm \ - --label "eco.version=${ECO_VERSION}" \ - --build-arg ECO_FILENAME="${ECO_FILENAME}" \ - -t ${DOCKER_TARGET} . + --label "eco.version=${ECO_VERSION}" \ + --build-arg ECO_VERSION="${ECO_VERSION}" \ + -t ${DOCKER_TARGET} \ + -t ${DOCKER_IMAGE} \ + . push: - docker push ${DOCKER_TARGET} + docker push ${DOCKER_IMAGE} clean: rm -rf "${ECO_FILENAME}" diff --git a/README.md b/README.md index 4702bc6..78ccd4b 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ``` mkdir -p ~/eco-server/Storage ~/eco-server/Configs -docker run -d --name "eco-server" -v ~/eco-server/Storage:/srv/eco-server/Storage -v ~/eco-server/Configs:/srv/eco-server/Configs --network=host t3hk0d3/eco-server:0.7.1.2-beta +docker run -d --name "eco-server" -v ~/eco-server/Storage:/srv/eco-server/Storage -v ~/eco-server/Configs:/srv/eco-server/Configs --network=host t3hk0d3/eco-server:latest ``` ## How to build diff --git a/SHA256SUMS b/SHA256SUMS index 568c67e..f688259 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -1 +1,2 @@ 61270db3e806e08e00d08a0c00eed78941e7a62a50e14529faaa5754005c3ece *EcoServer_v0.7.1.2-beta.zip +771e9bbeb7d6f259f13eb6d5b781dcc6722d53b6f3dfc1515d422d2b783e87df *EcoServer_v0.7.2.3-beta.zip diff --git a/install.sh b/install.sh index 96a6227..dca4ca4 100755 --- a/install.sh +++ b/install.sh @@ -1,9 +1,22 @@ #!/bin/bash -ECO_FILENAME=$1 +ECO_INSTALL_DIR="/srv/eco-server" -unzip /tmp/${ECO_FILENAME} -d /srv/eco-server/ || exit 1 +ECO_FILENAME="EcoServer_v${ECO_VERSION}.zip" -rm -rf /tmp/* +ECO_SERVER_URL="https://s3-us-west-2.amazonaws.com/eco-releases/$ECO_FILENAME" +ECO_LOCAL_FILE="$ECO_INSTALL_DIR/$ECO_FILENAME" + + +wget --progress=bar:force:noscroll $ECO_SERVER_URL -O $ECO_LOCAL_FILE || exit 1 + +# Check file for only specific version +grep "$ECO_FILENAME" SHA256SUMS | sha256sum -c - || exit 1 + +unzip -q $ECO_LOCAL_FILE -d $ECO_INSTALL_DIR + +# Move defaults so they could be copied on start, not overwritten by mounted volumes +mv Configs DefaultConfigs +mv Storage DefaultStorage exit 0 diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..7feed1f --- /dev/null +++ b/start.sh @@ -0,0 +1,16 @@ +#!/bin/bash + + +if [ ! -f Configs/WorldGenerator.eco ]; then + echo "Copying default configs" + mkdir -p Configs + cp DefaultConfigs/* Configs/ +fi + +if [ ! -f Storage/DefaultWorld ]; then + echo "Copying default storage" + mkdir -p Storage + cp DefaultStorage/* Storage/ +fi + +mono EcoServer.exe -nogui