Skip to content
This repository has been archived by the owner on Nov 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2 from goncalo-oliveira/develop
Browse files Browse the repository at this point in the history
fixed detached run
  • Loading branch information
goncalo-oliveira authored Feb 10, 2021
2 parents b95d147 + c0fca8e commit 71f5f5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# stage 1
FROM mcr.microsoft.com/dotnet/sdk:5.0 as builder
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim as builder

# suppress data collection
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
Expand Down
18 changes: 10 additions & 8 deletions src/DockerWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace OpenFaaS
{
internal class DockerWrapper
{
private readonly string dockerImage = "goncalo-oliveira/faas-run";
private readonly string dockerImage = "docker.pkg.github.com/goncalo-oliveira/faas-run/faas-run";

private string GetImageTag()
{
Expand All @@ -25,8 +25,9 @@ private string GetImageTag()
public void RunDetached( Options options )
{
// to run detached we need the full path, not the relative
var assemblyPath = System.IO.Path.GetFullPath( options.Assembly );
var assemblyFile = System.IO.Path.GetFileName( assemblyPath );
var assemblyFullPath = System.IO.Path.GetFullPath( options.Assembly );
var assemblyPath = System.IO.Path.GetDirectoryName( assemblyFullPath );
var assemblyFile = System.IO.Path.GetFileName( assemblyFullPath );

var configPath = !string.IsNullOrEmpty( options.Config ) && System.IO.File.Exists( options.Config )
? System.IO.Path.GetFullPath( options.Config )
Expand All @@ -44,26 +45,27 @@ public void RunDetached( Options options )
"run",
"-d",
$"-p {options.Port}:80",
$"-v {assemblyPath}:/home/app/{assemblyFile}:ro",
$"-v {assemblyPath}:/home/app/:ro",
!string.IsNullOrEmpty( configPath )
? $"-v {configPath}:/home/app/config.json:ro"
? $"-v {configPath}:/home/config.json:ro"
: string.Empty,
$"{dockerImage}:{imageTag}",
"faas-run",
$"/home/app/{assemblyFile}",
"-p 80",
options.NoAuth ? "--no-auth" : string.Empty,
!string.IsNullOrEmpty( configPath )
? $"/home/app/config.json"
? "--config /home/config.json"
: string.Empty,
}
.Where( x => !string.IsNullOrEmpty( x ) )
.ToArray();

var dockerArgs = string.Join( (char)0x20, args );

// Console.WriteLine( $"docker pull {dockerImage}:{imageTag}" );
// Console.WriteLine( "docker " + dockerArgs );
// Console.WriteLine( $"docker pull {dockerImage}:{imageTag}" );
// Console.WriteLine( "docker " + dockerArgs );
// return;

// pull faas-run image
var pullExitCode = Exec( "docker", $"pull {dockerImage}:{imageTag}" );
Expand Down
2 changes: 1 addition & 1 deletion src/faas-run.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Version>1.6</Version>
<Version>1.6.1</Version>
<Authors>Goncalo Oliveira</Authors>
<Description>FaaS runner for ASPNET functions</Description>
<RepositoryUrl>https://github.com/goncalo-oliveira/faas-run</RepositoryUrl>
Expand Down

0 comments on commit 71f5f5e

Please sign in to comment.