Skip to content

Commit

Permalink
Docker image creation for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkJamesHoward committed Nov 18, 2024
1 parent 4df6ec0 commit f8980e7
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 3 deletions.
3 changes: 3 additions & 0 deletions DockerFile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ RUN apk add git

WORKDIR /App/docker-test-folder
RUN git init
RUN git config --global user.email "[email protected]"
RUN git config --global user.name "Mark Howard"

WORKDIR /App
ENTRYPOINT ["tail", "-f", "/dev/null"]
9 changes: 9 additions & 0 deletions DockerFilePub
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine

RUN apk update
RUN apk add git

RUN mkdir -p /my-app/docker-test-folder
WORKDIR /my-app/docker-test-folder
RUN git init
WORKDIR /
1 change: 1 addition & 0 deletions HelperClasses/FileWatching.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static void OnChanged(object sender, FileSystemEventArgs e)
BatchingUpFileChanges = false;

Console.WriteLine($"Batch {batch} Processing.....");
DebugMessages.FileChanged(e?.Name);
GitRepoExaminer.Run();
Console.WriteLine($"Batch {batch} Completed.....");
}
Expand Down
4 changes: 4 additions & 0 deletions Logging/DebugMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

public abstract class DebugMessages()
{
public static void FileChanged(string filename)
{
logger?.LogDebug($"File changed: {filename}");
}
public static void FoundFileOfType(string type, string hash)
{
logger?.LogDebug($"Processing file of type {type.Replace('\n', ' ')} hashCode={hash}");
Expand Down
2 changes: 1 addition & 1 deletion Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"visual": {
"commandName": "Project",
"commandLineArgs": "-p /App/docker-test-folder -d"
"commandLineArgs": "-p c:\\dev\\test -d"
}
}
}
23 changes: 21 additions & 2 deletions notes.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
-- Docker builds
dotnet publish --os linux --arch x64 /t:PublishContainer

-- Create the docker image manually rather than Dotnet doing it for us with /t:publishContainer
docker build -t visual-git -f DockerFile .
-- *** This is the approach currenlty working for DOCKER***** ------

-- Create the docker image manually rather than Dotnet doing it for us with /t:publishContainer
-- this Docker File copies over the source so we can run 'dotnet run' on the bash in docker
docker build -t visual-git -f DockerFile .

--Then update the launch settings
{
"profiles": {
"visual": {
"commandName": "Project",
"commandLineArgs": "-p /App/docker-test-folder -d"
}
}
}

-----------------------------------------------------------------


-- Create a base Image that can be used with PublishContainer
docker build -t bigusbirdicus/ashotofcode:visualgit-baseimage -f DockerFilePub .

-- Building
dotnet publish --os linux --self-contained true -p:PublishSingleFile=true
Expand Down
4 changes: 4 additions & 0 deletions visual.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<PropertyGroup>
<IsPublishable>true</IsPublishable>
<EnableSdkContainerSupport>true</EnableSdkContainerSupport>
<ContainerRepository>visual-git-container-dotnetpublished</ContainerRepository>
<ContainerBaseImage>docker.io/bigusbirdicus/ashotofcode:visualgit-baseimage</ContainerBaseImage>
<ContainerWorkingDirectory>app</ContainerWorkingDirectory>
<ContainerAppCommandInstruction>Entrypoint</ContainerAppCommandInstruction>
</PropertyGroup>


Expand Down

0 comments on commit f8980e7

Please sign in to comment.