Skip to content

Commit

Permalink
Merge pull request #2 from bcgov/dev-env-setup
Browse files Browse the repository at this point in the history
Enable hot-reloading and remote debugging for backend code
  • Loading branch information
ronaldo-macapobre authored Jul 12, 2024
2 parents c396f95 + 7e9feb1 commit ff49ae2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
9 changes: 9 additions & 0 deletions docker/api/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0

ENV ASPNETCORE_ENVIRONMENT='Production'
ENV ASPNETCORE_URLS='http://+:5000'
ENV CORS_DOMAIN='http://localhost:8080'
ENV DOTNET_STARTUP_PROJECT='./api/api.csproj'
ENV DOTNET_USE_POLLING_FILE_WATCHER 1

RUN curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l /vsdbg
13 changes: 11 additions & 2 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,19 @@ services:
ports:
- 5000:5000
volumes:
- ../api/:/opt/app-root/src/api
- ../db/:/opt/app-root/src/db
- ../jc-interface-client/:/opt/app-root/src/jc-interface-client
- scv-api-dev-bin:/opt/app-root/src/api/bin
- scv-api-dev-obj:/opt/app-root/src/api/obj
- ./seed:/opt/app-root/data
depends_on:
- db
command: >
/bin/bash -c "
echo Waiting for the database service to start up ...;
sleep 10;
/usr/libexec/s2i/run;"
dotnet watch run --project /opt/app-root/src/api/api.csproj --urls='http://+:5000';"
db:
image: centos/postgresql-12-centos8
Expand All @@ -72,4 +77,8 @@ services:
ports:
- 5432:5432
volumes:
- ./tmp:/tmp2
- ./tmp:/tmp2

volumes:
scv-api-dev-bin:
scv-api-dev-obj:
15 changes: 5 additions & 10 deletions docker/manage
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,12 @@ build-api() {
# api
#
echo -e "\n\n===================================================================================================="
echo -e "Building api image using s2i ..."
echo -e "Building api image using docker ..."
echo -e "----------------------------------------------------------------------------------------------------"
${S2I_EXE} build \
--copy \
-e "ASPNETCORE_ENVIRONMENT=Production" \
-e "ASPNETCORE_URLS=http://+:5000" \
-e "CORS_DOMAIN=http://localhost:8080" \
-e "DOTNET_STARTUP_PROJECT=./api/api.csproj" \
'..' \
'registry.access.redhat.com/ubi8/dotnet-80:8.0' \
'scv-api'
docker build \
-t 'scv-api' \
-f './api//Dockerfile.dev' '..'

echo -e "===================================================================================================="
}

Expand Down

0 comments on commit ff49ae2

Please sign in to comment.