-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile-backend
More file actions
55 lines (47 loc) · 1.37 KB
/
Dockerfile-backend
File metadata and controls
55 lines (47 loc) · 1.37 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Staging
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 as stage
WORKDIR /Stage
COPY . .
RUN dotnet restore
ENV USINGDOCKER true
# Install node so can call dotnet publish to publish the backend (Will remove later)
RUN if [ "$USINGDOCKER"="false" ]; then echo '================= USINGDOCKER has been set to false ===================='; else apt-get update -yq \
&& apt-get install curl gnupg -yq \
&& curl -sL https://deb.nodesource.com/setup_13.x | bash \
&& apt-get install nodejs -yq; fi
RUN dotnet publish -c Release -o output
RUN ls output
WORKDIR /Stage/output
RUN ls -l
# Build Node Frontend
FROM node:alpine as react
WORKDIR /Stage
COPY ClientApp .
RUN npm install
RUN npm run-script build
RUN ls -l
# Runtime
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 as runtime
WORKDIR /Code
# Copy Certs
# RUN mkdir Certs
# RUN ls -l
# COPY ./Certs Certs
# RUN ls Certs
# Copy build folder from frontend
COPY --from=react /Stage/ .
# Copy backend
COPY --from=stage /Stage/output .
# Env
# ENV ASPNETCORE_URLS=https://*:$PORT;http://*:$PORT
# ENV ASPNETCORE_ENVIRONMENT=Production
# Copy script from local
COPY ./wait-for-it.sh .
CMD dos2unix wait-for-it.sh
RUN chmod +x wait-for-it.sh
# Transfer react prod files to wwwroot folder
RUN mv build wwwroot
RUN ls -l
RUN ls wwwroot
EXPOSE 80 443
CMD [ "./wait-for-it.sh", "sql:1433", "-t", "0", "--", "dotnet", "DotNetCoreReactREST.dll" ]