feat: production release

This commit is contained in:
Fernando Araoz 2025-01-11 19:17:23 -05:00
parent 4650be94c4
commit d43d4fa190
3 changed files with 54 additions and 8 deletions

View File

@ -1,8 +1,19 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
WORKDIR /app WORKDIR /app
COPY . .
# Copy only what is neccesary for the build,
# so that small changes dont reset the whole build
COPY Controllers ./Controllers
COPY Migrations ./Migrations
COPY Model ./Model
COPY Properties ./Properties
COPY Program.cs .
COPY Trazo.csproj .
COPY WeatherForecast.cs .
COPY appsettings.json .
RUN dotnet restore RUN dotnet restore
RUN dotnet publish -c Release -o out RUN dotnet publish -c Release -r linux-musl-x64 -o out
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
WORKDIR /app WORKDIR /app

View File

@ -1,6 +0,0 @@
@Trazo_HostAddress = http://localhost:5233
GET {{Trazo_HostAddress}}/weatherforecast/
Accept: application/json
###

41
docker-compose.prod.yml Normal file
View File

@ -0,0 +1,41 @@
services:
aspnet-prison-prod:
container_name: aspnet-prison-prod
image: trazo-aspnet-prod
ports:
- "5233:8080"
networks:
- aspnet-network
aspnet-postgres:
image: postgres:latest
container_name: aspnet-postgres
restart: always
environment:
POSTGRES_DB: postgres
POSTGRES_USER: root
POSTGRES_PASSWORD: root
PGDATA: /var/lib/postgresql/data
# ports:
# - '5432:5432'
networks:
- aspnet-network
aspnet-pgadmin4:
image: elestio/pgadmin:latest
container_name: aspnet-pgadmin
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: admin@admin.com
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_LISTEN_PORT: 8080
ports:
- "8080:8080"
volumes:
- ./servers.json:/pgadmin4/servers.json
networks:
- aspnet-network
networks:
aspnet-network:
driver: bridge