From 1fbdb9c59067de5a13724d1fb72a3f096f6ea960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Wed, 26 Feb 2020 00:10:00 +0100 Subject: [PATCH] auto-generated docker image for server-cli based on kaniko like i researched for torvus and correct release branch detection: - https://gitlab.com/veloren/torvus/-/commit/ade4d375756ffa1eb1ac32f25aec3c6738bed6cc --- .gitlab-ci.yml | 49 ++++++++++++++++++++++++++++------- server-cli/Dockerfile | 8 ++++++ server-cli/docker-compose.yml | 17 ++++++++++++ server-cli/docker-run.sh | 3 +++ 4 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 server-cli/Dockerfile create mode 100644 server-cli/docker-compose.yml create mode 100755 server-cli/docker-run.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 813eabf4c0..b90be89601 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,8 @@ variables: stages: - optional-builds - check-compile - - post + - build-post + - publish before_script: - source $HOME/.cargo/env @@ -90,10 +91,10 @@ security: # -- -# -- post build +# -- build-post unittests: - stage: post + stage: build-post when: delayed start_in: 5 seconds tags: @@ -103,7 +104,7 @@ unittests: - cargo test || cargo test || cargo test || cargo test coverage: - stage: post + stage: build-post when: delayed start_in: 5 seconds tags: @@ -113,7 +114,7 @@ coverage: - cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v benchmarks: - stage: post + stage: build-post when: delayed start_in: 5 seconds tags: @@ -125,7 +126,7 @@ benchmarks: localization-status: variables: GIT_DEPTH: 0 - stage: post + stage: build-post when: delayed start_in: 5 seconds allow_failure: true @@ -135,14 +136,15 @@ localization-status: - cargo test -q test_all_localizations -- --nocapture --ignored linux: - stage: post + stage: build-post when: delayed start_in: 5 seconds only: refs: - /^r[0-9]+\.[0-9]+\.[0-9]+/ - - /^v[0-9]+\.[0-9]+\.[0-9]+/ + - /^v[0-9]+\.[0-9]+/ - /^master$/ + - /^docker-server$/ tags: - veloren-docker script: @@ -160,13 +162,13 @@ linux: expire_in: 1 week windows: - stage: post + stage: build-post when: delayed start_in: 5 seconds only: refs: - /^r[0-9]+\.[0-9]+\.[0-9]+/ - - /^v[0-9]+\.[0-9]+\.[0-9]+/ + - /^v[0-9]+\.[0-9]+/ - /^master$/ tags: - veloren-docker @@ -182,3 +184,30 @@ windows: - LICENSE expire_in: 1 week # -- + +# -- publish + +docker: + stage: publish + when: delayed + start_in: 5 seconds + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + dependencies: + - linux + before_script: + - ls "$CI_PROJECT_DIR/server-cli/" + only: + refs: + - /^r[0-9]+\.[0-9]+\.[0-9]+/ + - /^v[0-9]+\.[0-9]+/ + - /^master$/ + - /^docker-server$/ + tags: + - veloren-docker + script: + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-server" + +# -- diff --git a/server-cli/Dockerfile b/server-cli/Dockerfile new file mode 100644 index 0000000000..eacecc7846 --- /dev/null +++ b/server-cli/Dockerfile @@ -0,0 +1,8 @@ +FROM debian:stable-slim + +ARG PROJECTNAME=server-cli + +COPY ./server-cli/docker-run.sh /opt/docker-run.sh +COPY ./veloren-server-cli /opt/veloren-server-cli +COPY ./assets/common /opt/assets/common +COPY ./assets/world /opt/assets/world diff --git a/server-cli/docker-compose.yml b/server-cli/docker-compose.yml new file mode 100644 index 0000000000..ba9badf7de --- /dev/null +++ b/server-cli/docker-compose.yml @@ -0,0 +1,17 @@ +version: "3.7" + +services: + game-server: + image: registry.gitlab.com/veloren/veloren:master-server + ports: + - "14004:14004" + - "14005:14005" + deploy: + replicas: 1 + update_config: + parallelism: 2 + delay: 10s + order: stop-first + failure_action: rollback + restart_policy: + condition: on-failure diff --git a/server-cli/docker-run.sh b/server-cli/docker-run.sh new file mode 100755 index 0000000000..e965090fdb --- /dev/null +++ b/server-cli/docker-run.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cd /opt +RUST_LOG=info,common=debug,common::net=info RUST_BACKTRACE=1 /opt/veloren-server-cli