Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/API/LeadershipProfile/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/

**/.DS_Store
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose.y*ml
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
35 changes: 35 additions & 0 deletions src/API/LeadershipProfile/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Build stage for .NET
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS base

# Need to install Node JS in order to compile the React app
RUN apt update && \
apt install -y nodejs npm

# Start a new layer in order to cache the ASP.Net + node layer for reuse
FROM base AS build

COPY . /source
WORKDIR /source/src/Web/ClientApp

# Pre-install npm packages to bring them into the package cache
RUN --mount=type=cache,target=/root/.npm \
npm ci --omit=dev && \
npm run build

WORKDIR /source/src/Web

RUN --mount=type=cache,target=/root/.npm \
--mount=type=cache,id=nuget,target=/root/.nuget/packages \
dotnet publish --use-current-runtime --self-contained false -o /app

# Final layer only requires the ASP.Net runtime.
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS final
WORKDIR /app

COPY --from=build /app .

USER $APP_UID

EXPOSE 8080

ENTRYPOINT ["dotnet", "/app/LeadershipProfile.Web.dll"]
12 changes: 12 additions & 0 deletions src/API/LeadershipProfile/README.Docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Running Leadership Profile in Docker

> [!NOTE]
> This has been tested to the extent of opening the sign-in screen in a browser.
> Note that the sample compose file does not include a database, and the app
> settings have not been tuned

```shell
docker build -t LeadershipProfile.Web:latest --load .
docker run -d -p 8080:8080 LeadershipProfile.Web:latest
curl http://localhost:8080
```
50 changes: 50 additions & 0 deletions src/API/LeadershipProfile/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Docker Compose reference guide at
# https://docs.docker.com/go/compose-spec-reference/

# Here the instructions define your application as a service called "server".
# This service is built from the Dockerfile in the current directory.
# You can add other services your application may depend on here, such as a
# database or a cache. For examples, see the Awesome Compose repository:
# https://github.com/docker/awesome-compose
services:
server:
build:
context: .
target: final
ports:
- 8080:8080

# The commented out section below is an example of how to define a PostgreSQL
# database that your application can use. `depends_on` tells Docker Compose to
# start the database before your application. The `db-data` volume persists the
# database data between container restarts. The `db-password` secret is used
# to set the database password. You must create `db/password.txt` and add
# a password of your choosing to it before running `docker compose up`.
# depends_on:
# db:
# condition: service_healthy
# db:
# image: postgres
# restart: always
# user: postgres
# secrets:
# - db-password
# volumes:
# - db-data:/var/lib/postgresql/data
# environment:
# - POSTGRES_DB=example
# - POSTGRES_PASSWORD_FILE=/run/secrets/db-password
# expose:
# - 5432
# healthcheck:
# test: [ "CMD", "pg_isready" ]
# interval: 10s
# timeout: 5s
# retries: 5
# volumes:
# db-data:
# secrets:
# db-password:
# file: db/password.txt