fix: add Dockerfile and docker-compose configuration for backend and frontend services
Some checks failed
Build and Deploy to Production / deploy (push) Has been cancelled
Some checks failed
Build and Deploy to Production / deploy (push) Has been cancelled
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# Ignore common files that shouldn't be in the container
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
@@ -13,16 +14,23 @@
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/obj
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
**/.idea
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.user
|
||||
**/*.suo
|
||||
**/*.userosscache
|
||||
**/*.sln.docstates
|
||||
|
||||
# Include all .csproj files - they are needed for the build
|
||||
!**/*.csproj
|
||||
!**/*.sln
|
||||
!**/.gitignore
|
||||
!.git/HEAD
|
||||
!.git/config
|
||||
|
||||
47
backend/Dockerfile
Normal file
47
backend/Dockerfile
Normal file
@@ -0,0 +1,47 @@
|
||||
# Build stage - using .NET SDK
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
# Copy project files first for better layer caching
|
||||
COPY ["*.sln", "./"]
|
||||
COPY ["JoaoLoureiro.Portfolio.Api/*.csproj", "JoaoLoureiro.Portfolio.Api/"]
|
||||
COPY ["JoaoLoureiro.Portfolio.Application/*.csproj", "JoaoLoureiro.Portfolio.Application/"]
|
||||
COPY ["JoaoLoureiro.Portfolio.Domain/*.csproj", "JoaoLoureiro.Portfolio.Domain/"]
|
||||
COPY ["JoaoLoureiro.Portfolio.Infrastructure/*.csproj", "JoaoLoureiro.Portfolio.Infrastructure/"]
|
||||
|
||||
# Restore dependencies
|
||||
WORKDIR "/src/JoaoLoureiro.Portfolio.Api"
|
||||
RUN dotnet restore
|
||||
|
||||
# Copy remaining source code
|
||||
WORKDIR "/src"
|
||||
COPY . .
|
||||
|
||||
# Build and publish
|
||||
WORKDIR "/src/JoaoLoureiro.Portfolio.Api"
|
||||
RUN dotnet publish -c Release -o /app/publish
|
||||
|
||||
# Runtime stage
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
# curl used by docker-compose healthcheck
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Configure logging to show in container logs
|
||||
ENV ASPNETCORE_ENVIRONMENT=Development
|
||||
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
ENV ASPNETCORE_URLS=http://+:3001
|
||||
ENV ASPNETCORE_HTTP_PORT=3001
|
||||
ENV ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS=true
|
||||
|
||||
# Expose the port
|
||||
EXPOSE 3001
|
||||
|
||||
# Copy published app
|
||||
COPY --from=build /app/publish .
|
||||
|
||||
# Entry point with enhanced logging
|
||||
ENTRYPOINT ["dotnet", "JoaoLoureiro.Portfolio.Api.dll"]
|
||||
Reference in New Issue
Block a user