Skip to content

Commit

Permalink
Merge pull request #3 from Cecropia/SetupDotNetDocker
Browse files Browse the repository at this point in the history
Setup dot net docker
  • Loading branch information
cvillarongace authored Oct 16, 2024
2 parents ba24a4e + afd58ca commit e32b3f5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
17 changes: 17 additions & 0 deletions KeyCloakIntegration/DockerFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /KeyCloakIntegration
RUN apt-get update -yq
RUN apt-get install curl gnupg -yq
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
RUN apt-get install -y nodejs
# Copy everything
COPY . ./
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish ./src/Web/ -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
COPY --from=build-env /KeyCloakIntegration/out .
ENTRYPOINT ["dotnet", "KeyCloakIntegration.Web.dll"]
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
1. Pull KeyCloak image from DockerHub with the following command
`docker pull keycloak/keycloak`
1. Start Keycloak with the following command `docker run -p 8080:8080 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:26.0.0 start-dev` This command starts Keycloak exposed on the local port 8080 and creates an initial admin user with the `username admin` and `password admin`.
1. Log in into [Keycloak](http://localhost:8080/admin)
1. Log in into [Keycloak](http://localhost:8080/admin)

# DotNet Setup
1. From [DockerFile directory](/KeyCloakIntegration/) run: `docker build -t dotnet_keycloak-image -f DockerFile .`
1. Start app with the following command `docker run -d -p 8081:8080 dotnet_keycloak-image`
1. Navigate to [app]((http://localhost:8081/)

0 comments on commit e32b3f5

Please sign in to comment.