-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
32 lines (25 loc) · 881 Bytes
/
Dockerfile
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
# Builds an image with both the OpenMTS backend server and frontend
# --- 1: Build frontend ---
FROM node:lts-alpine as frontend-build-env
WORKDIR /app
# Copy package.json and package-lock.json and install dependencies
COPY ./mts-frontend/package*.json ./
RUN npm install
# Copy everything else and build
COPY ./mts-frontend .
RUN npm run build
# --- 2: Build backend ---
FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS backend-build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY ./mts-backend/src/OpenMTS/*.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY ./mts-backend/src/OpenMTS ./
RUN dotnet publish -c Release -o out
# --- 3: Build runtime ---
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1
WORKDIR /app
COPY --from=backend-build-env /app/out .
COPY --from=frontend-build-env /app/dist ./wwwroot
ENTRYPOINT ["dotnet", "OpenMTS.dll"]