add docker
This commit is contained in:
parent
dda1fca264
commit
7ab9f46e64
6 changed files with 77 additions and 2 deletions
25
.dockerignore
Normal file
25
.dockerignore
Normal file
|
@ -0,0 +1,25 @@
|
|||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/.idea
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
43
Femto.Api/Dockerfile
Normal file
43
Femto.Api/Dockerfile
Normal file
|
@ -0,0 +1,43 @@
|
|||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
|
||||
|
||||
# Create a non-root user and group
|
||||
ARG APP_UID=1000
|
||||
ARG APP_GID=1000
|
||||
RUN groupadd --gid $APP_GID appgroup && \
|
||||
useradd --uid $APP_UID --gid appgroup --create-home appuser
|
||||
|
||||
# Create data directory with correct ownership
|
||||
RUN mkdir -p /app/blob-storage-data && \
|
||||
chown -R appuser:appgroup /app
|
||||
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
EXPOSE 8081
|
||||
|
||||
# Switch to non-root user
|
||||
USER appuser
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["Femto.Api/Femto.Api.csproj", "Femto.Api/"]
|
||||
COPY ["Femto.Modules.Blog/Femto.Modules.Blog.csproj", "Femto.Modules.Blog/"]
|
||||
COPY ["Femto.Common/Femto.Common.csproj", "Femto.Common/"]
|
||||
COPY ["Femto.Modules.Auth.Contracts/Femto.Modules.Auth.Contracts.csproj", "Femto.Modules.Auth.Contracts/"]
|
||||
COPY ["Femto.Modules.Auth/Femto.Modules.Auth.csproj", "Femto.Modules.Auth/"]
|
||||
COPY ["Femto.Modules.Media/Femto.Modules.Media.csproj", "Femto.Modules.Media/"]
|
||||
RUN dotnet restore "Femto.Api/Femto.Api.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/Femto.Api"
|
||||
RUN dotnet build "Femto.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "Femto.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
|
||||
# Entrypoint
|
||||
ENTRYPOINT ["dotnet", "Femto.Api.dll"]
|
|
@ -29,4 +29,10 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\.dockerignore">
|
||||
<Link>.dockerignore</Link>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"BlobStorageRoot": "/app/blob-storage-data",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
|
|
|
@ -46,7 +46,8 @@ public static class AuthStartup
|
|||
{
|
||||
builder.UseNpgsql();
|
||||
builder.UseSnakeCaseNamingConvention();
|
||||
builder.EnableSensitiveDataLogging();
|
||||
var loggerFactory = LoggerFactory.Create(b => { });
|
||||
builder.UseLoggerFactory(loggerFactory);
|
||||
});
|
||||
|
||||
services.ConfigureDomainServices<AuthContext>();
|
||||
|
|
|
@ -60,7 +60,6 @@ public static class BlogStartup
|
|||
builder.UseSnakeCaseNamingConvention();
|
||||
var loggerFactory = LoggerFactory.Create(b => { });
|
||||
builder.UseLoggerFactory(loggerFactory);
|
||||
builder.EnableSensitiveDataLogging();
|
||||
});
|
||||
|
||||
services.AddOutbox<BlogContext, OutboxMessageHandler>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue