-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Dockerfile-Back
32 lines (28 loc) · 1.18 KB
/
Dockerfile-Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Based on Microsoft's docker samples for dotnet core
# available at https://github.com/dotnet/dotnet-docker/tree/master/samples/aspnetapp
FROM mcr.microsoft.com/dotnet/sdk:7.0-jammy AS build
# First install nodejs - required to build generated client app
WORKDIR /app
RUN apt-get update -yq && apt-get install -yq curl
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get update && \
apt-get install -yq nodejs && \
rm -rf /var/lib/apt/lists/*
# Restore dependencies of .net core projects taking advantage of docker layer caching
COPY src/*/*.csproj ./src/
COPY Directory.Packages.props Directory.Packages.props
RUN for file in $(ls src/*.csproj); do mkdir -p ${file%.*} && mv $file ${file%.*}; done
RUN dotnet restore "src/Jhipster/Jhipster.csproj"
# Copy everything else and build app
COPY . ./
WORKDIR src/Jhipster/
RUN dotnet publish "Jhipster.csproj" -c Release -o /app/out
# Final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:7.0-jammy AS runtime
EXPOSE 80
WORKDIR /app
COPY docker-entrypoint-back.sh .
RUN chmod +x /app/docker-entrypoint-back.sh
COPY --from=build /app/out .
ENV ASPNETCORE_ENVIRONMENT=Production
ENTRYPOINT ["./docker-entrypoint-back.sh"]