From 12bc8a1282f27df1b9afcff3f3e91a7bf01d8b00 Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Tue, 20 Aug 2019 18:47:00 -0400 Subject: [PATCH] Added required files --- .dockerignore | 1 + .gitlab-ci.yml | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 14 ++++++++++++ entrypoint.sh | 3 +++ 4 files changed, 80 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitlab-ci.yml create mode 100644 Dockerfile create mode 100644 entrypoint.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7e57652 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +*/.git/* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..adc804c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,62 @@ +image: docker:latest + +stages: + - Build Base + - Build Variants + - Push Images + +0-build-base: + stage: Build Base + artifacts: + expire_in: 1 week + paths: + - ./images/ + tags: + - docker + before_script: + - mkdir ./images + script: + - docker build --pull --build-arg "MC_SERVER_VERSION=$MC_SERVER_VERSION" -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" . + - docker save --output "./images/$CI_COMMIT_SHORT_SHA.tar" "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" + +1A-push-dev: + stage: Push Images + dependencies: + - 0-build-base + - 1-build-git + tags: + - docker + before_script: + - docker load --input "./images/$CI_COMMIT_SHORT_SHA.tar" + - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin + script: + - docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:dev-$MC_SERVER_VERSION" + - docker push "$CI_REGISTRY_IMAGE:dev-$MC_SERVER_VERSION" + +1B-push-version: + stage: Push Images + dependencies: + - 0-build-base + tags: + - docker + when: manual + before_script: + - docker load --input "./images/$CI_COMMIT_SHORT_SHA.tar" + - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin + script: + - docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:$MC_SERVER_VERSION" + - docker push "$CI_REGISTRY_IMAGE:$MC_SERVER_VERSION" + +1C-push-latest: + stage: Push Images + dependencies: + - 0-build-base + tags: + - docker + when: manual + before_script: + - docker load --input "./images/$CI_COMMIT_SHORT_SHA.tar" + - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin + script: + - docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:latest" + - docker push "$CI_REGISTRY_IMAGE:latest" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..982b2b2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:latest +LABEL maintainer="William Miceli " +USER root + +ARG MC_SERVER_VERSION + +# Download and setup Minecraft Server archive +#Located at https://minecraft.azureedge.net/bin-linux/bedrock-server-${MC_SERVER_VERSION}.zip + + +COPY /entrypoint.sh / + +EXPOSE 80 +CMD ["/bin/sh", "/entrypoint.sh"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..319a2b4 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +# Command to run: `LD_LIBRARY_PATH=. ./bedrock_server`