From f23b8099f1b5687cf17b62dfe1a33c8f951d7e32 Mon Sep 17 00:00:00 2001 From: runebaas Date: Fri, 19 Jun 2020 22:20:05 +0200 Subject: [PATCH] Try to create a docker image --- .gitignore | 10 +-- .gitlab-ci.yml | 62 ++++++++++--------- Dockerfile | 6 +- .../Lib/Converters/MtgManaConverter.cs | 2 - 4 files changed, 38 insertions(+), 42 deletions(-) diff --git a/.gitignore b/.gitignore index fe7e3d4..5db124b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,6 @@ -Geekbot.net/bin -Geekbot.net/obj +*/bin/ +*/obj/ Geekbot.net/tmp/ -Tests/bin -Tests/obj -Backup/ .vs/ UpgradeLog.htm .idea @@ -12,5 +9,4 @@ Geekbot.net/Logs/* !/Geekbot.net/Logs/.keep Geekbot.net.sln.DotSettings.user Geekbot.net/temp/ -WikipediaApi/bin/ -WikipediaApi/obj/ +app \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d6f3e15..86c6459 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,46 +1,40 @@ stages: - build - - ops + - docker - deploy + - ops -before_script: - - set -e - - set -u - - set -o pipefail - -build: +Build: stage: build image: mcr.microsoft.com/dotnet/core/sdk:5.0-focal artifacts: expire_in: 1h paths: - - Geekbot.net/Binaries/ + - app script: - dotnet restore - dotnet test Tests - - dotnet publish --version-suffix ${CI_COMMIT_SHA:0:8} --configuration Release -o ./Geekbot.net/Binaries ./Geekbot.net/ + - dotnet publish --version-suffix ${CI_COMMIT_SHA:0:8} -r linux-x64 -c Release -o ./app ./Geekbot.net/ -sentry: - stage: ops - image: getsentry/sentry-cli - allow_failure: true - only: - - master - dependencies: - - build - script: - - sentry-cli releases new -p geekbot 4.2.0-${CI_COMMIT_SHA:0:8} - - sentry-cli releases set-commits --auto 4.2.0-${CI_COMMIT_SHA:0:8} - - sentry-cli releases deploys 4.2.0-${CI_COMMIT_SHA:0:8} new -e Production +Package: + stage: docker + image: docker +# only: +# - master + services: + - docker:stable-dind + variables: + IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + script: + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - docker build -t $IMAGE_TAG . + - docker push $IMAGE_TAG -deploy: +Deploy: stage: deploy image: runebaas/rsync-ssh-git only: - master - dependencies: - - build - - sentry environment: name: Production url: https://discordapp.com/oauth2/authorize?client_id=171249478546882561&scope=bot&permissions=1416834054 @@ -54,13 +48,21 @@ deploy: - rsync -rav -e "ssh -p 65432" ./Geekbot.net/Binaries/* geekbot@$DEPIP:$DEPPATH - ssh -p 65432 geekbot@$DEPIP "sudo systemctl restart geekbot.service" -mirror: - stage: deploy +Sentry: + stage: ops + image: getsentry/sentry-cli + allow_failure: true + only: + - master + script: + - sentry-cli releases new -p geekbot 4.2.0-${CI_COMMIT_SHA:0:8} + - sentry-cli releases set-commits --auto 4.2.0-${CI_COMMIT_SHA:0:8} + - sentry-cli releases deploys 4.2.0-${CI_COMMIT_SHA:0:8} new -e Production + +Github Mirror: + stage: ops image: runebaas/rsync-ssh-git only: - master - dependencies: - - build - - sentry script: - git push https://runebaas:$TOKEN@github.com/pizzaandcoffee/Geekbot.net.git origin/master:master -f diff --git a/Dockerfile b/Dockerfile index 7594bec..822471d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -FROM microsoft/dotnet:2.1-aspnetcore-runtime +FROM mcr.microsoft.com/dotnet/core/aspnet:5.0-focal -COPY Geekbot.net/Binaries /app/ +COPY ./app /app/ EXPOSE 12995/tcp WORKDIR /app -ENTRYPOINT ./run.sh +ENTRYPOINT ./Geekbot.net diff --git a/Geekbot.net/Lib/Converters/MtgManaConverter.cs b/Geekbot.net/Lib/Converters/MtgManaConverter.cs index 7e90df0..cfd893b 100644 --- a/Geekbot.net/Lib/Converters/MtgManaConverter.cs +++ b/Geekbot.net/Lib/Converters/MtgManaConverter.cs @@ -1,7 +1,5 @@ using System.Collections.Generic; -using System.IO; using System.Text.RegularExpressions; -using Utf8Json; namespace Geekbot.net.Lib.Converters {