Added Dockerfile for API and Web apps
This commit is contained in:
@ -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
|
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 443
|
# EXPOSE 443 # SSL termination expected
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["YABA.API/YABA.API.csproj", "YABA.API/"]
|
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"
|
RUN dotnet restore "YABA.API/YABA.API.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/YABA.API"
|
WORKDIR "/src/YABA.API"
|
||||||
RUN dotnet build "YABA.API.csproj" -c Release -o /app/build
|
RUN dotnet build "YABA.API.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
FROM build AS publish
|
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
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
1
Web/.dockerignore
Normal file
1
Web/.dockerignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules/
|
||||||
13
Web/Dockerfile
Normal file
13
Web/Dockerfile
Normal file
@ -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;"]
|
||||||
Reference in New Issue
Block a user