-
-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Dockerfile - added proper multistage build and replaced sample …
…from Bank Accounts to Cinema Tickets (as it's more complete) Added pgAdmin image to docker-compose to be able to see changes in DB Added .dockerignore to not copy binaries into the docker build Added missing projects to Tickets/Tickets.sln Updated README information about .NET
- Loading branch information
1 parent
cc16294
commit f26d4d3
Showing
9 changed files
with
113 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
**/bin/ | ||
**/obj/ | ||
**/out/ | ||
**/TestResults/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,3 +250,5 @@ paket-files/ | |
# JetBrains Rider | ||
.idea/ | ||
*.sln.iml | ||
|
||
**/out |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
######################################## | ||
# First stage of multistage build | ||
######################################## | ||
# Use Build image with label `builder | ||
######################################## | ||
FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS builder | ||
|
||
# Setup working directory for project | ||
WORKDIR /app | ||
|
||
COPY ./Core/Core.csproj ./Core/ | ||
COPY ./Core.Marten/Core.Marten.csproj ./Core.Marten/ | ||
COPY ./Sample/Tickets/Tickets/Tickets.csproj ./Sample/Tickets/Tickets/ | ||
COPY ./Sample/Tickets/Tickets.Api/ ./Sample/Tickets/Tickets.Api/ | ||
|
||
# Restore nuget packages | ||
RUN dotnet restore ./Sample/Tickets/Tickets.Api/Tickets.Api.csproj | ||
|
||
# Copy project files | ||
COPY ./Core ./Core | ||
COPY ./Core.Marten ./Core.Marten | ||
COPY ./Sample/Tickets/Tickets ./Sample/Tickets/Tickets | ||
COPY ./Sample/Tickets/Tickets.Api ./Sample/Tickets/Tickets.Api | ||
|
||
# Build project with Release configuration | ||
# and no restore, as we did it already | ||
RUN dotnet build -c Release --no-restore ./Sample/Tickets/Tickets.Api/Tickets.Api.csproj | ||
|
||
## Test project with Release configuration | ||
## and no build, as we did it already | ||
#RUN dotnet test -c Release --no-build ./Sample/Tickets/Tickets.Api/Tickets.Api.csproj | ||
|
||
|
||
# Publish project to output folder | ||
# and no build, as we did it already | ||
WORKDIR /app/Sample/Tickets/Tickets.Api | ||
RUN ls | ||
RUN dotnet publish -c Release --no-build -o out | ||
|
||
######################################## | ||
# Second stage of multistage build | ||
######################################## | ||
# Use other build image as the final one | ||
# that won't have source codes | ||
######################################## | ||
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine | ||
|
||
# Setup working directory for project | ||
WORKDIR /app | ||
|
||
# Copy published in previous stage binaries | ||
# from the `builder` image | ||
COPY --from=builder /app/Sample/Tickets/Tickets.Api/out . | ||
|
||
# Set URL that App will be exposed | ||
ENV ASPNETCORE_URLS="http://*:5000" | ||
|
||
# sets entry point command to automatically | ||
# run application on `docker run` | ||
ENTRYPOINT ["dotnet", "Tickets.Api.dll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ services: | |
container_name: postgres | ||
hostname: postgres | ||
environment: | ||
- postgres/variables.env | ||
POSTGRES_PASSWORD: Password12! | ||
ports: | ||
- "5432:5432" | ||
networks: | ||
|
@@ -15,13 +15,25 @@ services: | |
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
pgadmin: | ||
image: dpage/pgadmin4 | ||
container_name: pgadmin | ||
environment: | ||
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:[email protected]} | ||
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin} | ||
ports: | ||
- "${PGADMIN_PORT:-5050}:80" | ||
networks: | ||
- es_network | ||
|
||
backend: | ||
build: | ||
dockerfile: DOCKERFILE | ||
dockerfile: Dockerfile | ||
context: . | ||
container_name: event_sourcing_sample | ||
ports: | ||
- "5000:5000" | ||
- "5555:5000" | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
|