-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker all the things! #2
base: master
Are you sure you want to change the base?
Changes from 2 commits
0079e63
974505d
8a8befc
9749fdb
a037658
2803257
9160bb9
d22276a
23aa541
ac96eea
3a473d5
e494d33
ff27ec1
b2c49d5
3314d8a
05cb0a3
7a56ac5
0930bfd
9045e4c
77e9aea
0275a76
3063940
b978f58
06accc0
8482bf3
c2f7bfc
9b53cf8
498d1cc
4b26d86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY ./ . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally this should be broken into layers of dependency. I need to research the right way to do this for a .net project like this. |
||
RUN dotnet restore | ||
|
||
WORKDIR /source/Zune.Net.Catalog.Image | ||
RUN dotnet publish -c release -o /app --no-restore | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 | ||
WORKDIR /app | ||
COPY --from=build /app ./ | ||
ENV DOTNET_EnableDiagnostics=0 | ||
ENTRYPOINT ["dotnet", "Zune.Net.Catalog.Image.dll"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"ZuneNetContext": { | ||
"ConnectionString": "mongodb://localhost:27017", | ||
"ConnectionString": "mongodb://mongo:27017", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In docker, you can expose things like connection strings to a running container as an environment variables. I'm gonna probably revert this to localhost and define the runtime connection strings in |
||
"DatabaseName": "Zune" | ||
}, | ||
"Logging": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY ./ . | ||
RUN dotnet restore | ||
|
||
WORKDIR /source/Zune.Net.Catalog | ||
RUN dotnet publish -c release -o /app --no-restore | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 | ||
WORKDIR /app | ||
COPY --from=build /app ./ | ||
ENV DOTNET_EnableDiagnostics=0 | ||
ENTRYPOINT ["dotnet", "Zune.Net.Catalog.dll"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY ./ . | ||
RUN dotnet restore | ||
|
||
WORKDIR /source/Zune.Net.Catalog | ||
RUN dotnet publish -c release -o /app --no-restore | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 | ||
WORKDIR /app | ||
COPY --from=build /app ./ | ||
ENV DOTNET_EnableDiagnostics=0 | ||
ENTRYPOINT ["dotnet", "Zune.Net.Catalog.dll"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"ZuneNetContext": { | ||
"ConnectionString": "mongodb://localhost:27017", | ||
"ConnectionString": "mongodb://mongo:27017", | ||
"DatabaseName": "Zune", | ||
"MemberCollectionName": "Members" | ||
}, | ||
|
@@ -11,7 +11,7 @@ | |
*/ | ||
"AzureAd": { | ||
"Instance": "https://login.microsoftonline.com/", | ||
"Domain": "commerce.zunes.me", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like I missed one. |
||
"Domain": "commerce.zune.net", | ||
"TenantId": "common", | ||
"ClientId": "e7dd59f1-8ea4-49b6-8361-1b10b2551dba", | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,12 +68,13 @@ public ActionResult<MessageDetails> Details(string locale, string zuneTag, strin | |
[HttpGet] | ||
public IActionResult UnreadCont(string locale, string zuneTag) | ||
{ | ||
using var ctx = new ZuneNetContext(); | ||
Member member = ctx.Members.First(m => m.ZuneTag == zuneTag); | ||
if (member == null) | ||
return StatusCode(StatusCodes.Status400BadRequest, $"User {zuneTag} does not exist."); | ||
// using var ctx = new ZuneNetContext(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not compile right now. Do you have a branch where it does, that I should rebase against? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, I just haven't touched messaging in a long time. Don't worry about it |
||
// Member member = ctx.Members.First(m => m.ZuneTag == zuneTag); | ||
// if (member == null) | ||
// return StatusCode(StatusCodes.Status400BadRequest, $"User {zuneTag} does not exist."); | ||
|
||
return Content(member.Messages.Count(msg => !msg.IsRead).ToString()); | ||
// return Content(member.Messages.Count(msg => !msg.IsRead).ToString()); | ||
return Content("1"); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY ./ . | ||
RUN dotnet restore | ||
|
||
WORKDIR /source/Zune.Net.Inbox | ||
RUN dotnet publish -c release -o /app --no-restore | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 | ||
WORKDIR /app | ||
COPY --from=build /app ./ | ||
ENV DOTNET_EnableDiagnostics=0 | ||
ENTRYPOINT ["dotnet", "Zune.Net.Inbox.dll"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY ./ . | ||
RUN dotnet restore | ||
|
||
WORKDIR /source/Zune.Net.Login | ||
RUN dotnet publish -c release -o /app --no-restore | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 | ||
WORKDIR /app | ||
COPY --from=build /app ./ | ||
ENV DOTNET_EnableDiagnostics=0 | ||
ENTRYPOINT ["dotnet", "Zune.Net.Login.dll"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY ./ . | ||
RUN dotnet restore | ||
|
||
WORKDIR /source/Zune.Net.MetaServices | ||
RUN dotnet publish -c release -o /app --no-restore | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 | ||
WORKDIR /app | ||
COPY --from=build /app ./ | ||
ENV DOTNET_EnableDiagnostics=0 | ||
ENTRYPOINT ["dotnet", "Zune.Net.MetaServices.dll"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY ./ . | ||
RUN dotnet restore | ||
|
||
WORKDIR /source/Zune.Net.Mix | ||
RUN dotnet publish -c release -o /app --no-restore | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 | ||
WORKDIR /app | ||
COPY --from=build /app ./ | ||
ENV DOTNET_EnableDiagnostics=0 | ||
ENTRYPOINT ["dotnet", "Zune.Net.Mix.dll"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY ./ . | ||
RUN dotnet restore | ||
|
||
WORKDIR /source/Zune.Net.SocialApi | ||
RUN dotnet publish -c release -o /app --no-restore | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 | ||
WORKDIR /app | ||
COPY --from=build /app ./ | ||
ENV DOTNET_EnableDiagnostics=0 | ||
ENTRYPOINT ["dotnet", "Zune.Net.SocialApi.dll"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY ./ . | ||
RUN dotnet restore | ||
|
||
WORKDIR /source/Zune.Net.Tiles | ||
RUN dotnet publish -c release -o /app --no-restore | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 | ||
WORKDIR /app | ||
COPY --from=build /app ./ | ||
ENV DOTNET_EnableDiagnostics=0 | ||
ENTRYPOINT ["dotnet", "Zune.Net.Tiles.dll"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY ./ . | ||
RUN dotnet restore | ||
|
||
WORKDIR /source/Zune.Net.Tuners | ||
RUN dotnet publish -c release -o /app --no-restore | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 | ||
WORKDIR /app | ||
COPY --from=build /app ./ | ||
ENV DOTNET_EnableDiagnostics=0 | ||
ENTRYPOINT ["dotnet", "Zune.Net.Tuners.dll"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
version: '3.4' | ||
|
||
services: | ||
mongodb: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably need to see if this can start and finish booting before the rest of the containers start |
||
image: mongo:latest | ||
environment: | ||
MONGO_INITDB_ROOT_USERNAME: root | ||
MONGO_INITDB_ROOT_PASSWORD: rootpassword | ||
ports: | ||
- 27017:27017 | ||
volumes: | ||
- mongodb_data_container:/data/db | ||
|
||
catalog: | ||
build: | ||
context: ./ | ||
dockerfile: Zune.Net.Catalog/Dockerfile | ||
|
||
catalog.image: | ||
build: | ||
context: ./ | ||
dockerfile: Zune.Net.Catalog.Image/Dockerfile | ||
|
||
commerce: | ||
build: | ||
context: ./ | ||
dockerfile: Zune.Net.Commerce/Dockerfile | ||
|
||
inbox: | ||
build: | ||
context: ./ | ||
dockerfile: Zune.Net.Inbox/Dockerfile | ||
|
||
login: | ||
build: | ||
context: ./ | ||
dockerfile: Zune.Net.Login/Dockerfile | ||
|
||
metaservices: | ||
build: | ||
context: ./ | ||
dockerfile: Zune.Net.MetaServices/Dockerfile | ||
|
||
mix: | ||
build: | ||
context: ./ | ||
dockerfile: Zune.Net.Mix/Dockerfile | ||
|
||
social: | ||
build: | ||
context: ./ | ||
dockerfile: Zune.Net.SocialApi/Dockerfile | ||
|
||
tiles: | ||
build: | ||
context: ./ | ||
dockerfile: Zune.Net.Tiles/Dockerfile | ||
|
||
tuners: | ||
build: | ||
context: ./ | ||
dockerfile: Zune.Net.Tuners/Dockerfile | ||
|
||
volumes: | ||
mongodb_data_container: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be pulled into
IConfiguration
so that it can be one of many configuration types including environment variables.