Docker Setup
This commit is contained in:
parent
a0d98b4d77
commit
d15058f0c9
4 changed files with 130 additions and 6 deletions
|
|
@ -1,18 +1,71 @@
|
||||||
services:
|
services:
|
||||||
# PostgreSQL Database
|
# PostgreSQL Database
|
||||||
# User: postgres
|
|
||||||
# Password: postgres
|
|
||||||
# Port: 5432
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:17
|
image: postgres:17-alpine
|
||||||
restart: always
|
restart: always
|
||||||
container_name: local-postgres
|
container_name: local-postgres
|
||||||
ports:
|
|
||||||
- "5432:5432"
|
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_DB: postgres
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
# Auth API - Internal member validation service
|
||||||
|
auth-api:
|
||||||
|
build:
|
||||||
|
context: ./src/Auth
|
||||||
|
dockerfile: ./AuthAPI/Dockerfile
|
||||||
|
container_name: auth-api
|
||||||
|
restart: unless-stopped
|
||||||
|
# No ports exposed externally
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
|
# These should be replaced with real values or set in an .env file
|
||||||
|
- EnvironmentVariables__ApiUrl=https://sverok-api-url-here
|
||||||
|
- EnvironmentVariables__ApiKey=YOUR_SVEROK_API_KEY
|
||||||
|
- EnvironmentVariables__AssociationNumber=YOUR_ASSOCIATION_NUMBER
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
|
||||||
|
# Registration API - Core backend service
|
||||||
|
registration-api:
|
||||||
|
build:
|
||||||
|
context: ./src/Registration
|
||||||
|
dockerfile: ./Registration.API/Dockerfile
|
||||||
|
container_name: registration-api
|
||||||
|
restart: unless-stopped
|
||||||
|
# No ports exposed externally
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
|
- ConnectionStrings__DefaultConnection=Host=postgres;Username=postgres;Password=postgres;Database=postgres;Port=5432
|
||||||
|
- AuthApi__BaseUrl=http://auth-api:8080
|
||||||
|
- VbytesRelay__BaseUrl=https://api.lan.vbytes.se
|
||||||
|
- VbytesRelay__ApiKey=YOUR_VBYTES_API_KEY
|
||||||
|
- VbytesRelay__ClientCertificatePfxPath=/app/certs/server.pfx
|
||||||
|
- Security__SsnPepper=YOUR_SSN_PEPPER
|
||||||
|
- Admin__Password=admin
|
||||||
|
volumes:
|
||||||
|
- ./server.pfx:/app/certs/server.pfx:ro
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
- auth-api
|
||||||
|
|
||||||
|
# Web Frontend - User interface
|
||||||
|
lan-frontend:
|
||||||
|
build:
|
||||||
|
context: ./src/Web/lan-frontend
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
- REGISTRATION_API_URL=http://registration-api:8080
|
||||||
|
container_name: lan-frontend
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "5000:3000"
|
||||||
|
environment:
|
||||||
|
- REGISTRATION_API_URL=http://registration-api:8080
|
||||||
|
depends_on:
|
||||||
|
- registration-api
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|
|
||||||
19
src/Auth/AuthAPI/Dockerfile
Normal file
19
src/Auth/AuthAPI/Dockerfile
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy csproj and restore
|
||||||
|
COPY AuthAPI/AuthAPI.csproj ./AuthAPI/
|
||||||
|
RUN dotnet restore AuthAPI/AuthAPI.csproj
|
||||||
|
|
||||||
|
# Copy everything else and build
|
||||||
|
COPY AuthAPI/. ./AuthAPI/
|
||||||
|
WORKDIR /app/AuthAPI
|
||||||
|
RUN dotnet publish -c Release -o /app/out
|
||||||
|
|
||||||
|
# Runtime stage
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /app/out .
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
ENTRYPOINT ["dotnet", "AuthAPI.dll"]
|
||||||
23
src/Registration/Registration.API/Dockerfile
Normal file
23
src/Registration/Registration.API/Dockerfile
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy all project files and restore
|
||||||
|
COPY Registration.API/Registration.API.csproj ./Registration.API/
|
||||||
|
COPY Registration.Infra/Registration.Infra.csproj ./Registration.Infra/
|
||||||
|
COPY Registration.Domain/Registration.Domain.csproj ./Registration.Domain/
|
||||||
|
RUN dotnet restore Registration.API/Registration.API.csproj
|
||||||
|
|
||||||
|
# Copy all source files and build
|
||||||
|
COPY Registration.API/. ./Registration.API/
|
||||||
|
COPY Registration.Infra/. ./Registration.Infra/
|
||||||
|
COPY Registration.Domain/. ./Registration.Domain/
|
||||||
|
WORKDIR /app/Registration.API
|
||||||
|
RUN dotnet publish -c Release -o /app/out
|
||||||
|
|
||||||
|
# Runtime stage
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /app/out .
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
ENTRYPOINT ["dotnet", "Registration.API.dll"]
|
||||||
29
src/Web/lan-frontend/Dockerfile
Normal file
29
src/Web/lan-frontend/Dockerfile
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
FROM node:20-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# Copy source and build
|
||||||
|
COPY . .
|
||||||
|
# We don't need these during build if they're runtime, but let's be safe
|
||||||
|
ARG REGISTRATION_API_URL
|
||||||
|
ENV REGISTRATION_API_URL=$REGISTRATION_API_URL
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Runtime stage
|
||||||
|
FROM node:20-alpine AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
|
COPY --from=build /app/package*.json ./
|
||||||
|
COPY --from=build /app/.next ./.next
|
||||||
|
COPY --from=build /app/public ./public
|
||||||
|
COPY --from=build /app/node_modules ./node_modules
|
||||||
|
COPY --from=build /app/next.config.ts ./next.config.ts
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
CMD ["npm", "start"]
|
||||||
Loading…
Reference in a new issue