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
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

View file

@ -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
Package:
stage: docker
image: docker
# only:
# - master
services:
- docker:stable-dind
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
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
- 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

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

View file

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