-
-
Notifications
You must be signed in to change notification settings - Fork 516
/
Dockerfile
216 lines (160 loc) · 5.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
COPY ./*.sln ./NuGet.Config ./
COPY ./src/*.props ./src/
COPY ./tests/*.props ./tests/
COPY ./build/packages/* ./build/packages/
# Copy the main source project files
COPY src/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p src/${file%.*}/ && mv $file src/${file%.*}/; done
# Copy the test project files
COPY tests/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p tests/${file%.*}/ && mv $file tests/${file%.*}/; done
RUN dotnet restore
# Copy everything else and build app
COPY . .
RUN dotnet build -c Release
# testrunner
FROM build AS testrunner
WORKDIR /app/tests/Exceptionless.Tests
ENTRYPOINT dotnet test --results-directory /app/artifacts --logger:trx
# job-publish
FROM build AS job-publish
WORKDIR /app/src/Exceptionless.Job
RUN dotnet publish -c Release -o out
# job
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS job
WORKDIR /app
COPY --from=job-publish /app/src/Exceptionless.Job/out ./
EXPOSE 8080
ENTRYPOINT [ "dotnet", "Exceptionless.Job.dll" ]
# api-publish
FROM build AS api-publish
WORKDIR /app/src/Exceptionless.Web
RUN apt-get update -yq
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -yq nodejs
RUN dotnet publish -c Release -o out /p:SkipSpaPublish=true
# api
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS api
WORKDIR /app
COPY --from=api-publish /app/src/Exceptionless.Web/out ./
EXPOSE 8080
ENTRYPOINT [ "dotnet", "Exceptionless.Web.dll" ]
# app-publish
FROM build AS app-publish
WORKDIR /app/src/Exceptionless.Web
RUN apt-get update -yq
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -yq nodejs
RUN dotnet publish -c Release -o out
# app
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS app
WORKDIR /app
COPY --from=app-publish /app/src/Exceptionless.Web/out ./
COPY ./build/app-docker-entrypoint.sh ./
COPY ./build/update-config.sh /usr/local/bin/update-config
COPY ./build/update-config-next.sh /usr/local/bin/update-config-next
ENV EX_ConnectionStrings__Storage=provider=folder;path=/app/storage \
EX_RunJobsInProcess=true \
ASPNETCORE_URLS=http://+:8080 \
EX_Html5Mode=true
RUN chmod +x /app/app-docker-entrypoint.sh
RUN chmod +x /usr/local/bin/update-config
RUN chmod +x /usr/local/bin/update-config-next
EXPOSE 8080
ENTRYPOINT ["/app/app-docker-entrypoint.sh"]
# completely self-contained
FROM exceptionless/elasticsearch:8.17.0 AS exceptionless
WORKDIR /app
COPY --from=job-publish /app/src/Exceptionless.Job/out ./
COPY --from=app-publish /app/src/Exceptionless.Web/out ./
COPY ./build/docker-entrypoint.sh ./
COPY ./build/update-config.sh /usr/local/bin/update-config
COPY ./build/update-config-next.sh /usr/local/bin/update-config-next
COPY ./build/supervisord.conf /etc/
USER root
# install dotnet and supervisor
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
wget \
apt-transport-https \
supervisor \
dos2unix \
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu66 \
libssl1.1 \
libstdc++6 \
zlib1g && \
dos2unix /app/docker-entrypoint.sh
ENV discovery.type=single-node \
xpack.security.enabled=false \
ES_JAVA_OPTS="-Xms1g -Xmx1g" \
ASPNETCORE_URLS=http://+:8080 \
DOTNET_RUNNING_IN_CONTAINER=true \
EX_ConnectionStrings__Storage=provider=folder;path=/app/storage \
EX_ConnectionStrings__Elasticsearch=server=http://localhost:9200 \
EX_RunJobsInProcess=true \
EX_Html5Mode=true
RUN chmod +x /app/docker-entrypoint.sh && \
chmod +x /usr/local/bin/update-config && \
chmod +x /usr/local/bin/update-config-next && \
chown -R elasticsearch:elasticsearch /app && \
mkdir -p /var/log/supervisor >/dev/null 2>&1 && \
chown -R elasticsearch:elasticsearch /var/log/supervisor
USER elasticsearch
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && \
chmod +x dotnet-install.sh && \
./dotnet-install.sh --channel 9.0 --runtime aspnetcore && \
rm dotnet-install.sh
EXPOSE 8080 9200
ENTRYPOINT ["/app/docker-entrypoint.sh"]
# completely self-contained 7.x
FROM exceptionless/elasticsearch:7.17.19 AS exceptionless7
WORKDIR /app
COPY --from=job-publish /app/src/Exceptionless.Job/out ./
COPY --from=app-publish /app/src/Exceptionless.Web/out ./
COPY ./build/docker-entrypoint.sh ./
COPY ./build/update-config.sh /usr/local/bin/update-config
COPY ./build/update-config-next.sh /usr/local/bin/update-config-next
COPY ./build/supervisord.conf /etc/
USER root
# install dotnet and supervisor
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
wget \
apt-transport-https \
supervisor \
dos2unix \
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu66 \
libssl1.1 \
libstdc++6 \
zlib1g && \
dos2unix /app/docker-entrypoint.sh
ENV discovery.type=single-node \
xpack.security.enabled=false \
ES_JAVA_OPTS="-Xms1g -Xmx1g" \
ASPNETCORE_URLS=http://+:8080 \
DOTNET_RUNNING_IN_CONTAINER=true \
EX_ConnectionStrings__Storage=provider=folder;path=/app/storage \
EX_ConnectionStrings__Elasticsearch=server=http://localhost:9200 \
EX_RunJobsInProcess=true \
EX_Html5Mode=true
RUN chmod +x /app/docker-entrypoint.sh && \
chmod +x /usr/local/bin/update-config && \
chmod +x /usr/local/bin/update-config-next && \
chown -R elasticsearch:elasticsearch /app && \
mkdir -p /var/log/supervisor >/dev/null 2>&1 && \
chown -R elasticsearch:elasticsearch /var/log/supervisor
USER elasticsearch
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && \
chmod +x dotnet-install.sh && \
./dotnet-install.sh --channel 9.0 --runtime aspnetcore && \
rm dotnet-install.sh
EXPOSE 8080 9200
ENTRYPOINT ["/app/docker-entrypoint.sh"]
# build locally
# docker buildx build --target exceptionless --platform linux/amd64,linux/arm64 --load --tag exceptionless .