-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4472 from cisagov/feature/dockerize-backend
feature: dockerize backend
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 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,28 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the project files (csproj) and restore dependencies | ||
COPY ./CSETWeb_Api/CSETWeb_ApiCore/*.csproj ./ | ||
RUN dotnet restore | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Build the application | ||
RUN dotnet build CSETWeb_Api/CSETWeb_ApiCore --configuration Debug | ||
|
||
# Expose the port the app runs on (default for ASP.NET Core is 5000 for HTTP) | ||
EXPOSE 5000 | ||
|
||
# Set environment variables for development mode | ||
ENV ASPNETCORE_ENVIRONMENT=Development | ||
ENV ASPNETCORE_URLS=http://0.0.0.0:5000 | ||
|
||
|
||
COPY ./etc/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
RUN chmod a+x /usr/local/bin/entrypoint.sh | ||
|
||
# Run the application | ||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] |
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/bash | ||
|
||
# Run the API | ||
dotnet run --project CSETWeb_Api/CSETWeb_ApiCore |
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