-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile.web
More file actions
42 lines (31 loc) · 1.17 KB
/
Copy pathDockerfile.web
File metadata and controls
42 lines (31 loc) · 1.17 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
# multiple Dockerfile naming https://stackoverflow.com/a/63995752/1872200
# https://hub.docker.com/_/microsoft-dotnet-sdk
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS base
# Istall EF tool for database migration
RUN dotnet tool install --global dotnet-ef
# /app is mounted to a local app folder in docker-compose configuration
# We can't copy files to a working directory
WORKDIR /app
COPY ./entrypoint.web.sh /
RUN chmod +x /entrypoint.web.sh
ENTRYPOINT ["/entrypoint.web.sh"]
### Other configuration for production ###
FROM base as builder
# Copy the source code
COPY ./src/Codesanook.EFNote /workspace
WORKDIR /workspace
RUN mkdir /publish
# Restore all of the nugets
RUN dotnet restore
RUN dotnet publish -c Release -o /publish
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine AS release
ENV ASPNETCORE_URLS http://*:8000
EXPOSE 8000
COPY --from=builder /publish /dist
# Copy .NET Global tool
RUN mkdir -p /root/.dotnet/tools/
COPY --from=builder /root/.dotnet/tools/ /root/.dotnet/tools/
RUN apk add tree
WORKDIR /dist
# Database migration is "Update database" step in deploy-to-app-service-container.yml
ENTRYPOINT ["/bin/sh", "-c" , "sleep 10 && dotnet Codesanook.EFNote.dll"]