Build
This commit is contained in:
40
Dockerfile
Normal file
40
Dockerfile
Normal file
@@ -0,0 +1,40 @@
|
||||
# Build stage
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
# Install AOT prerequisites
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
clang \
|
||||
zlib1g-dev
|
||||
|
||||
# Copy solution file
|
||||
COPY ["Nashel.RF.sln", "./"]
|
||||
|
||||
# Copy project files
|
||||
COPY ["src/Host/Nashel.RF.Host.csproj", "src/Host/"]
|
||||
COPY ["src/BuildingBlocks/Nashel.RF.BuildingBlocks.csproj", "src/BuildingBlocks/"]
|
||||
COPY ["src/Modules/Catalog/Nashel.RF.Modules.Catalog.csproj", "src/Modules/Catalog/"]
|
||||
COPY ["src/Modules/Collaboration/Nashel.RF.Modules.Collaboration.csproj", "src/Modules/Collaboration/"]
|
||||
COPY ["src/Modules/Geo/Nashel.RF.Modules.Geo.csproj", "src/Modules/Geo/"]
|
||||
COPY ["src/Modules/Identity/Nashel.RF.Modules.Identity.csproj", "src/Modules/Identity/"]
|
||||
COPY ["src/Modules/Order/Nashel.RF.Modules.Order.csproj", "src/Modules/Order/"]
|
||||
COPY ["src/Modules/Reputation/Nashel.RF.Modules.Reputation.csproj", "src/Modules/Reputation/"]
|
||||
|
||||
# Restore dependencies
|
||||
RUN dotnet restore "Nashel.RF.sln"
|
||||
|
||||
# Copy the rest of the source code
|
||||
COPY . .
|
||||
|
||||
# Publish the application (AOT)
|
||||
WORKDIR "/src/src/Host"
|
||||
RUN dotnet publish "Nashel.RF.Host.csproj" -c Release -r linux-x64 --self-contained true -o /app/publish
|
||||
|
||||
# Final stage
|
||||
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0 AS final
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/publish .
|
||||
ENV ASPNETCORE_URLS=http://+:8080
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["./Nashel.RF.Host"]
|
||||
43
docker-compose.yml
Normal file
43
docker-compose.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: nashel-backend
|
||||
ports:
|
||||
- "5000:8080"
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
- ConnectionStrings__DefaultConnection=Host=db;Port=5432;Database=nashel;Username=postgres;Password=postgres
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- nashel-network
|
||||
|
||||
db:
|
||||
image: postgis/postgis:16-3.4
|
||||
container_name: nashel-db
|
||||
environment:
|
||||
- POSTGRES_DB=nashel
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- nashel-db-data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- nashel-network
|
||||
|
||||
volumes:
|
||||
nashel-db-data:
|
||||
|
||||
|
||||
networks:
|
||||
nashel-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user