mirror of
https://github.com/CannedNet/CannedNet.git
synced 2026-10-25 15:09:23 -07:00
feat: dockerfile
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
**/bin/
|
||||
**/obj/
|
||||
.git/
|
||||
.gitmodules/
|
||||
.idea/
|
||||
.DS_Store
|
||||
*.user
|
||||
*.DotSettings
|
||||
CannedNet/Data/PrivateKey.pem
|
||||
CannedNet/Data/PublicKey.pem
|
||||
CannedNet/config.json
|
||||
CannedNet.Admin/admin_users.json
|
||||
CannedNet.Admin/admin_config.json
|
||||
@@ -0,0 +1,19 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||
WORKDIR /src
|
||||
COPY CannedNet.slnx ./
|
||||
COPY CannedNet.Shared/CannedNet.Shared.csproj CannedNet.Shared/
|
||||
COPY CannedNet.Admin/CannedNet.Admin.csproj CannedNet.Admin/
|
||||
RUN dotnet restore CannedNet.Admin/CannedNet.Admin.csproj
|
||||
COPY . .
|
||||
WORKDIR /src/CannedNet.Admin
|
||||
RUN dotnet publish -c Release -o /app
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
|
||||
WORKDIR /app
|
||||
COPY --from=build /app .
|
||||
RUN chown -R app:app /app
|
||||
EXPOSE 8080
|
||||
ENV ASPNETCORE_URLS=http://+:8080
|
||||
ENV ASPNETCORE_ENVIRONMENT=Production
|
||||
USER app
|
||||
ENTRYPOINT ["dotnet", "CannedNet.Admin.dll"]
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"ServerBaseUrl": "https://cannednet.lapis.codes"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||
WORKDIR /src
|
||||
COPY CannedNet.slnx ./
|
||||
COPY CannedNet.Shared/CannedNet.Shared.csproj CannedNet.Shared/
|
||||
COPY CannedNet/CannedNet.csproj CannedNet/
|
||||
RUN dotnet restore CannedNet/CannedNet.csproj
|
||||
COPY . .
|
||||
WORKDIR /src/CannedNet
|
||||
RUN dotnet publish -c Release -o /app
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
|
||||
WORKDIR /app
|
||||
COPY --from=build /app .
|
||||
COPY --from=build /src/CannedNet/JSON JSON/
|
||||
RUN mkdir -p Data Images && chown -R app:app /app && chmod -R u+w /app
|
||||
EXPOSE 5000
|
||||
ENV ASPNETCORE_URLS=http://+:5000
|
||||
VOLUME ["/app/Data", "/app/Images"]
|
||||
USER app
|
||||
ENTRYPOINT ["dotnet", "CannedNet.dll"]
|
||||
@@ -0,0 +1,46 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:alpine
|
||||
restart: always
|
||||
container_name: postgres
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
env_file: ".env"
|
||||
volumes:
|
||||
- cannednet_pgdata:/var/lib/postgresql/cannednet/data
|
||||
ports:
|
||||
- "5532:5432"
|
||||
|
||||
cannednet:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: CannedNet/Dockerfile
|
||||
restart: always
|
||||
ports:
|
||||
- "5000:5000"
|
||||
environment:
|
||||
ConnectionStrings__DefaultConnection: "Host=postgres;Port=5432;Database=cannednet;Username=postgres;Password=${POSTGRES_PASSWORD:-postgres}"
|
||||
volumes:
|
||||
- cannednet_data:/app/Data
|
||||
- cannednet_images:/app/Images
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
admin:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: CannedNet.Admin/Dockerfile
|
||||
restart: always
|
||||
ports:
|
||||
- "5271:8080"
|
||||
depends_on:
|
||||
- cannednet
|
||||
|
||||
volumes:
|
||||
cannednet_pgdata:
|
||||
cannednet_data:
|
||||
cannednet_images:
|
||||
Reference in New Issue
Block a user