Skip to content

Commit

Permalink
Build container for use in Metadata GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
techman83 committed Dec 10, 2020
1 parent e8ba8fc commit 2f79e27
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Run tests
run: xvfb-run ./build test+only --configuration=Release --where="Category!=FlakyNetwork"

- name: Generate Docker image and publish to Hub
- name: Generate inflator Docker image and publish to Hub
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
Expand All @@ -72,6 +72,14 @@ jobs:
run: |
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
./build docker-inflator --exclusive
- name: Generate metadata tester Docker image and publish to Hub
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_PASSWORD }}
run: |
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
./build docker-metadata --exclusive
- name: Push ckan.exe and netkan.exe to S3
# Send ckan.exe and netkan.exe to https://ksp-ckan.s3-us-west-2.amazonaws.com/
uses: jakejarvis/s3-sync-action@master
Expand Down
8 changes: 8 additions & 0 deletions Dockerfile.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM mono:6.8

RUN apt-get update && \
apt-get install -y python3 python3-pip && \
apt-get clean

ADD netkan.exe /usr/local/bin/.
ADD ckan.exe /usr/local/bin/.
31 changes: 31 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,37 @@ Task("docker-inflator")
);
});

Task("docker-metadata")
.Description("Build the Docker image for the metadata testing and push it to Dockerhub.")
.IsDependentOn("Repack-Netkan")
.IsDependentOn("Repack-Ckan")
.Does(() =>
{
var dockerDirectory = buildDirectory.Combine("docker");
var metadataDirectory = dockerDirectory.Combine("metadata");
// Versions of Docker prior to 18.03.0-ce require the Dockerfile to be within the build context
var dockerFile = metadataDirectory.CombineWithFilePath("Dockerfile.metadata");
CreateDirectory(metadataDirectory);
CopyFile(buildDirectory.CombineWithFilePath("netkan.exe"),
metadataDirectory.CombineWithFilePath("netkan.exe"));
CopyFile(buildDirectory.CombineWithFilePath("ckan.exe"),
metadataDirectory.CombineWithFilePath("ckan.exe"));
CopyFile(rootDirectory.CombineWithFilePath("Dockerfile.metadata"), dockerFile);

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

Task("osx")
.Description("Build the macOS(OSX) dmg package.")
.IsDependentOn("Ckan")
Expand Down

0 comments on commit 2f79e27

Please sign in to comment.