Try to create a docker image

This commit is contained in:
runebaas 2020-06-19 22:20:05 +02:00
parent e0f17d00ea
commit f23b8099f1
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
4 changed files with 38 additions and 42 deletions

10
.gitignore vendored
View file

@ -1,9 +1,6 @@
Geekbot.net/bin */bin/
Geekbot.net/obj */obj/
Geekbot.net/tmp/ Geekbot.net/tmp/
Tests/bin
Tests/obj
Backup/
.vs/ .vs/
UpgradeLog.htm UpgradeLog.htm
.idea .idea
@ -12,5 +9,4 @@ Geekbot.net/Logs/*
!/Geekbot.net/Logs/.keep !/Geekbot.net/Logs/.keep
Geekbot.net.sln.DotSettings.user Geekbot.net.sln.DotSettings.user
Geekbot.net/temp/ Geekbot.net/temp/
WikipediaApi/bin/ app
WikipediaApi/obj/

View file

@ -1,46 +1,40 @@
stages: stages:
- build - build
- ops - docker
- deploy - deploy
- ops
before_script: Build:
- set -e
- set -u
- set -o pipefail
build:
stage: build stage: build
image: mcr.microsoft.com/dotnet/core/sdk:5.0-focal image: mcr.microsoft.com/dotnet/core/sdk:5.0-focal
artifacts: artifacts:
expire_in: 1h expire_in: 1h
paths: paths:
- Geekbot.net/Binaries/ - app
script: script:
- dotnet restore - dotnet restore
- dotnet test Tests - 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: Package:
stage: ops stage: docker
image: getsentry/sentry-cli image: docker
allow_failure: true # only:
only: # - master
- master services:
dependencies: - docker:stable-dind
- build variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
script: script:
- sentry-cli releases new -p geekbot 4.2.0-${CI_COMMIT_SHA:0:8} - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- sentry-cli releases set-commits --auto 4.2.0-${CI_COMMIT_SHA:0:8} - docker build -t $IMAGE_TAG .
- sentry-cli releases deploys 4.2.0-${CI_COMMIT_SHA:0:8} new -e Production - docker push $IMAGE_TAG
deploy: Deploy:
stage: deploy stage: deploy
image: runebaas/rsync-ssh-git image: runebaas/rsync-ssh-git
only: only:
- master - master
dependencies:
- build
- sentry
environment: environment:
name: Production name: Production
url: https://discordapp.com/oauth2/authorize?client_id=171249478546882561&scope=bot&permissions=1416834054 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 - rsync -rav -e "ssh -p 65432" ./Geekbot.net/Binaries/* geekbot@$DEPIP:$DEPPATH
- ssh -p 65432 geekbot@$DEPIP "sudo systemctl restart geekbot.service" - ssh -p 65432 geekbot@$DEPIP "sudo systemctl restart geekbot.service"
mirror: Sentry:
stage: deploy 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 image: runebaas/rsync-ssh-git
only: only:
- master - master
dependencies:
- build
- sentry
script: script:
- git push https://runebaas:$TOKEN@github.com/pizzaandcoffee/Geekbot.net.git origin/master:master -f - git push https://runebaas:$TOKEN@github.com/pizzaandcoffee/Geekbot.net.git origin/master:master -f

View file

@ -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 EXPOSE 12995/tcp
WORKDIR /app WORKDIR /app
ENTRYPOINT ./run.sh ENTRYPOINT ./Geekbot.net

View file

@ -1,7 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Utf8Json;
namespace Geekbot.net.Lib.Converters namespace Geekbot.net.Lib.Converters
{ {