Docker commands

This commit is contained in:
Mike Phares 2025-01-30 19:41:15 -07:00
parent d37ed1c01a
commit 3c4e465084
4 changed files with 72 additions and 7 deletions

66
.vscode/tasks.json vendored
View File

@ -88,6 +88,72 @@
], ],
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile"
}, },
{
"label": "dockerLogin",
"command": "docker",
"type": "process",
"args": [
"login",
"gitea.phares.duckdns.org:443"
],
"problemMatcher": "$msCompile"
},
{
"label": "dockerBuild",
"command": "docker",
"type": "process",
"args": [
"build",
"-t",
"kanbn-to-quartz"
],
"problemMatcher": "$msCompile"
},
{
"label": "dockerImageList",
"command": "docker",
"type": "process",
"args": [
"image",
"ls"
],
"problemMatcher": "$msCompile"
},
{
"label": "dockerRun",
"command": "docker",
"type": "process",
"args": [
"run",
"-p",
"5001:5001",
"--name",
"kanbn-to-quartz-api-001",
"cb5bbb2e84e7"
],
"problemMatcher": "$msCompile"
},
{
"label": "dockerTag",
"command": "docker",
"type": "process",
"args": [
"tag",
"b84c1f73de01",
"gitea.phares.duckdns.org:443/phares3757/kanbn-to-quartz:latest"
],
"problemMatcher": "$msCompile"
},
{
"label": "dockerPush",
"command": "docker",
"type": "process",
"args": [
"push",
"gitea.phares.duckdns.org:443/phares3757/kanbn-to-quartz:latest"
],
"problemMatcher": "$msCompile"
},
{ {
"label": "Publish AOT", "label": "Publish AOT",
"command": "dotnet", "command": "dotnet",

View File

@ -23,8 +23,3 @@ EXPOSE 5001
WORKDIR /app WORKDIR /app
COPY --from=publish /app/publish . COPY --from=publish /app/publish .
ENTRYPOINT [ "dotnet", "KanbnToQuartz.dll" ] ENTRYPOINT [ "dotnet", "KanbnToQuartz.dll" ]
# docker build -t sprint-console-001 .
# docker images ls | grep -i 001
# docker run -p 5001:5001 --name sprint-console-api-001 sprint-console-001
# docker run -p 5001:5001 --name sprint-console-api-001 sprint-console-001

View File

@ -6,6 +6,7 @@ namespace KanbnToQuartz.Models;
public record AppSettings(string Company, public record AppSettings(string Company,
string Destination, string Destination,
string DirectoryFindReplace, string DirectoryFindReplace,
string DirectoryBFindReplace,
string FileFindReplace, string FileFindReplace,
string Source, string Source,
string TextBFindReplace, string TextBFindReplace,

View File

@ -18,6 +18,7 @@ public class CopyService
List<Record> results = []; List<Record> results = [];
string path; string path;
string fileB; string fileB;
string pathB;
string textB; string textB;
string? text; string? text;
Record record; Record record;
@ -37,6 +38,7 @@ public class CopyService
string sourceDirectoryName = Path.GetDirectoryName(sourceDirectory); string sourceDirectoryName = Path.GetDirectoryName(sourceDirectory);
string destinationDirectory = Path.GetFullPath(appSettings.Destination); string destinationDirectory = Path.GetFullPath(appSettings.Destination);
string[] directoryFindReplace = appSettings.DirectoryFindReplace.Split('|'); string[] directoryFindReplace = appSettings.DirectoryFindReplace.Split('|');
string[] directoryBFindReplace = appSettings.DirectoryBFindReplace.Split('|');
string[] files = Directory.GetFiles(sourceDirectory, "*", SearchOption.AllDirectories); string[] files = Directory.GetFiles(sourceDirectory, "*", SearchOption.AllDirectories);
int sourceDirectoryLength = sourceDirectory.Length; int sourceDirectoryLength = sourceDirectory.Length;
foreach (string file in files) foreach (string file in files)
@ -56,8 +58,9 @@ public class CopyService
if (!lines[i].StartsWith(textBFindReplace)) if (!lines[i].StartsWith(textBFindReplace))
continue; continue;
path = lines[i].Substring(textBFindReplace.Length, lines[i].Length - 1 - textBFindReplace.Length); path = lines[i].Substring(textBFindReplace.Length, lines[i].Length - 1 - textBFindReplace.Length);
pathName = Path.GetFileName(path); pathB = string.IsNullOrEmpty(directoryBFindReplace[0]) ? path : path.Replace(directoryBFindReplace[0], directoryBFindReplace[1]);
relativePath = Path.GetRelativePath(sourceDirectoryName, path); pathName = Path.GetFileName(pathB);
relativePath = Path.GetRelativePath(sourceDirectoryName, pathB);
lines[i] = $"- [{pathName}]({relativePath})"; lines[i] = $"- [{pathName}]({relativePath})";
} }
textB = string.Join(Environment.NewLine, lines); textB = string.Join(Environment.NewLine, lines);