diff --git a/API/YABA.API/Dockerfile b/API/YABA.API/Dockerfile index f06ab78..80ba18a 100644 --- a/API/YABA.API/Dockerfile +++ b/API/YABA.API/Dockerfile @@ -1,20 +1,24 @@ -#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 -EXPOSE 443 +# EXPOSE 443 # SSL termination expected FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["YABA.API/YABA.API.csproj", "YABA.API/"] +COPY ["YABA.Common/YABA.Common.csproj", "YABA.Common/"] +COPY ["YABA.Data/YABA.Data.csproj", "YABA.Data/"] +COPY ["YABA.Models/YABA.Models.csproj", "YABA.Models/"] +COPY ["YABA.Service/YABA.Service.csproj", "YABA.Service/"] RUN dotnet restore "YABA.API/YABA.API.csproj" COPY . . WORKDIR "/src/YABA.API" RUN dotnet build "YABA.API.csproj" -c Release -o /app/build FROM build AS publish -RUN dotnet publish "YABA.API.csproj" -c Release -o /app/publish +RUN dotnet publish "YABA.API.csproj" -c Release -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app diff --git a/Web/.dockerignore b/Web/.dockerignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/Web/.dockerignore @@ -0,0 +1 @@ +node_modules/ diff --git a/Web/Dockerfile b/Web/Dockerfile new file mode 100644 index 0000000..bfa9c26 --- /dev/null +++ b/Web/Dockerfile @@ -0,0 +1,13 @@ +# https://www.knowledgehut.com/blog/web-development/how-to-dockerize-react-app +FROM node:17-alpine as builder +WORKDIR /app +COPY package-lock.json . +RUN npm install +COPY . . +RUN npm build + +FROM nginx:latest +WORKDIR /usr/share/nginx/html +RUN rm -rf ./* +COPY --from=builder /app/build . +ENTRYPOINT ["nginx", "-g", "daemon off;"] \ No newline at end of file