...
 
Commits (2)
......@@ -10,12 +10,16 @@ services:
- "9300:9300"
environment:
- "discovery.type=single-node"
networks:
- jon-backend
logstash:
image: docker.elastic.co/logstash/logstash:6.4.1
restart: always
depends_on:
- elasticsearch
networks:
- jon-backend
kibana:
image: docker.elastic.co/kibana/kibana:6.4.1
......@@ -24,3 +28,9 @@ services:
- elasticsearch
ports:
- "15601:5601"
networks:
- jon-backend
networks:
jon-backend:
external: true
\ No newline at end of file
*.swp
*.*~
project.lock.json
.DS_Store
*.pyc
nupkg/
# Visual Studio Code
.vscode
# Rider
.idea
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
msbuild.log
msbuild.err
msbuild.wrn
# Visual Studio 2015
.vs/
\ No newline at end of file
# .Net Core
I wanted to play around .net core. My code here is very hard-coded as my goal right now is "hello world" type work.
- hello_world: just that. a new console app.
- fwf: playing around with dotnet build then image creation in one docker build.
## Installtion
I followed Microsoft's installation instructions for OSX and ran into no issues.
## Hello World
I created a [hello world](https://docs.microsoft.com/en-us/dotnet/core/tutorials/using-with-xplat-cli) then followed their [docker guide](https://docs.microsoft.com/en-us/dotnet/core/docker/build-container).
```bash
dotnet run
dotnet publish -c Release
docker build . --tag jt-core-hw
docker run --rm jt-core-hw
```
\ No newline at end of file
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 as builder
COPY ./app /tmp/builder
WORKDIR /tmp/builder
RUN dotnet publish -c release
FROM mcr.microsoft.com/dotnet/core/runtime:2.2
COPY --from=builder /tmp/builder/bin/release/netcoreapp2.2/publish/ /app/
COPY ./example_input.txt /app/
ENTRYPOINT ["dotnet", "/app/fwf.dll"]
using System;
using System.IO;
namespace fwf
{
class Program
{
static void Main(string[] args)
{
using(var reader = new StreamReader("/app/example_input.txt"))
{
Console.WriteLine("Begin reading text file.");
while (!reader.EndOfStream)
{
string line = reader.ReadLine();
Console.WriteLine(line);
string city = line.Substring(0, 13).Trim();
string state = line.Substring(13, 6).Trim();
string country = line.Substring(20, 3).Trim();
Console.WriteLine(city);
Console.WriteLine(state);
Console.WriteLine(country);
}
Console.WriteLine("Done reading text file.");
}
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
</Project>
city state country
Chicago IL USA
Madison WI USA
New York NY USA
FROM mcr.microsoft.com/dotnet/core/runtime:2.2
# created with dotnet public -c Release
COPY ./myApp/bin/Release/netcoreapp2.2/publish/ /app/
ENTRYPOINT ["dotnet", "/app/myApp.dll"]
using System;
namespace myApp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Console.WriteLine("The current time is " + DateTime.Now);
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
</Project>