Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfile + Deployment for NetKAN Inflator #2838

Merged
merged 3 commits into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ language: csharp

sudo: required

services:
- docker

env:
global:
- BUILD_RELEASE_MONO_VERSION=5.16.0
- DOCKERHUB_USERNAME=kspckanbuilder
- secure: "UGXJG9jB9tGwjJXxG0Beu4Poz0leuiCBItnfTTKRm1a/NxXf1eoOH9p9icY5Ur2xHwqh0uWSznuL2aNr58CXtzTcMpXrcUhRsO63FB3Cz6tSdZEb+pKQJ23zmC9929DklKRGUT2D/eBcJcnV+/eAtkarrfLBU1avUQAVJgqXvMI="
matrix:
- BUILD_CONFIGURATION=Debug
- BUILD_CONFIGURATION=Release
Expand Down Expand Up @@ -46,6 +51,7 @@ script:
before_deploy:
- ./build osx
- ./build deb
- echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin

deploy:
# Releases (which are tagged) go to github
Expand Down Expand Up @@ -81,6 +87,15 @@ deploy:
branch: master
condition: $BUILD_CONFIGURATION = Release && $(mono --version | perl -ne'/version (\d+\.\d+\.\d+)/ and print $1') = $BUILD_RELEASE_MONO_VERSION

# Rebuild + Publish Netkan on every merge to master
- provider: script
skip_cleanup: true
script: ./build docker-inflator
on:
repo: KSP-CKAN/CKAN
branch: master
condition: $BUILD_CONFIGURATION = Release && $(mono --version | perl -ne'/version (\d+\.\d+\.\d+)/ and print $1') = $BUILD_RELEASE_MONO_VERSION

after_success:
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
- chmod +x send.sh
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile.netkan
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM mono:5.20.1
RUN useradd -ms /bin/bash netkan
USER netkan
WORKDIR /home/netkan
ADD netkan.exe .
ENTRYPOINT /usr/bin/mono netkan.exe --queues $QUEUES \
--github-token $GH_Token --cachedir ckan_cache -v
25 changes: 25 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#addin "nuget:?package=Cake.SemVer&version=3.0.0"
#addin "nuget:?package=semver&version=2.0.4"
#addin "nuget:?package=Cake.Docker&version=0.10.0"
#tool "nuget:?package=ILRepack&version=2.0.17"
#tool "nuget:?package=NUnit.ConsoleRunner&version=3.10.0"

Expand Down Expand Up @@ -33,6 +34,30 @@ Task("Ckan")
Task("Netkan")
.IsDependentOn("Repack-Netkan");

Task("docker-inflator")
.IsDependentOn("Repack-Netkan")
.Does(() =>
{
var dockerDirectory = buildDirectory.Combine("docker");
var inflatorDirectory = dockerDirectory.Combine("inflator");
CreateDirectory(inflatorDirectory);
CopyFile(buildDirectory.CombineWithFilePath("netkan.exe"),
inflatorDirectory.CombineWithFilePath("netkan.exe"));

var mainTag = "kspckan/inflator";
var latestTag = mainTag + ":latest";
DockerBuild(
new DockerImageBuildSettings()
{
File = "Dockerfile.netkan",
Tag = new string[] { mainTag }
},
inflatorDirectory.ToString()
);
DockerTag(mainTag, latestTag);
DockerPush(latestTag);
});

Task("osx")
.IsDependentOn("Ckan")
.Does(() => StartProcess("make",
Expand Down