ci: feat: add separate Dockerfile for FE and BE only

This commit is contained in:
2024-03-04 23:22:38 +01:00
parent 0f24f19c71
commit 22270f4bf7
4 changed files with 122 additions and 4 deletions
+20
View File
@@ -0,0 +1,20 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["Kemkas.Web/Kemkas.Web.csproj", "Kemkas.Web/"]
RUN dotnet restore "Kemkas.Web/Kemkas.Web.csproj"
COPY . .
WORKDIR "/src/Kemkas.Web"
RUN dotnet build "Kemkas.Web.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Kemkas.Web.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Kemkas.Web.dll"]
+2 -2
View File
@@ -13,5 +13,5 @@ RUN yarn build
FROM nginx:latest as proxy
# COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder "/src/build" "/usr/share/nginx/html"
COPY --from=builder "/src/build" "/usr/share/nginx/html"
COPY ./nginx.conf /etc/nginx/nginx.conf
+36
View File
@@ -0,0 +1,36 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
}