This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
87 lines (50 loc) · 1.89 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
ARG CONTAINER_RUNTIME_VERSION=2.2.6
ARG CONTAINER_RUNTIME=alpine3.9
FROM node:10.12.0-alpine AS build-javascript
ARG CLIENT_PACKAGE=@sqlstreamstore/browser
ARG CLIENT_VERSION=0.9.3
ARG NPM_REGISTRY=https://www.myget.org/F/sqlstreamstore/npm/
ENV REACT_APP_CLIENT_VERSION=${CLIENT_VERSION}
WORKDIR /app
RUN echo "@sqlstreamstore:registry=${NPM_REGISTRY}" > .npmrc && \
yarn init --yes && \
yarn add ${CLIENT_PACKAGE}@${CLIENT_VERSION}
WORKDIR /app/node_modules/${CLIENT_PACKAGE}
RUN yarn && \
yarn react-scripts-ts build && \
echo ${CLIENT_VERSION} > /app/.clientversion
FROM mcr.microsoft.com/dotnet/core/sdk:2.2.401-stretch AS build-dotnet
ARG CLIENT_PACKAGE=@sqlstreamstore/browser
ARG RUNTIME=alpine-x64
ARG LIBRARY_VERSION=1.2.0
WORKDIR /app
COPY ./*.sln ./
WORKDIR /app/src
COPY ./src/*/*.csproj ./src/Directory.Build.props ./
RUN for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done
WORKDIR /app/tests
COPY ./tests/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.*}/; done
WORKDIR /app
COPY ./NuGet.Config ./
RUN dotnet restore --runtime=${RUNTIME}
WORKDIR /app/src
COPY ./src .
COPY --from=build-javascript /app/node_modules/${CLIENT_PACKAGE}/build /app/src/SqlStreamStore.Server/Browser/build
WORKDIR /app/tests
COPY ./tests .
WORKDIR /app/build
COPY ./build/build.csproj .
RUN dotnet restore
COPY ./build .
WORKDIR /app/src
COPY ./src .
WORKDIR /app
COPY ./*.sln .git ./
RUN dotnet tool install -g minver-cli --version 1.0.0 && \
/root/.dotnet/tools/minver > .version
RUN dotnet run --project build/build.csproj -- --runtime=${RUNTIME} --library-version=${LIBRARY_VERSION}
FROM mcr.microsoft.com/dotnet/core/runtime-deps:${CONTAINER_RUNTIME_VERSION}-${CONTAINER_RUNTIME} AS runtime
WORKDIR /app
COPY --from=build-dotnet /app/publish /app/.version ./
ENTRYPOINT ["/app/SqlStreamStore.Server"]