-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (33 loc) · 1.24 KB
/
Dockerfile
File metadata and controls
44 lines (33 loc) · 1.24 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
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG RUN_TESTS
WORKDIR /src
# Copy everything
COPY . ./
RUN if [ "${RUN_TESTS}" = "yes" ]; then dotnet test; fi
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish /p:Version=$(date "+%y").$(date "+%m%d").$(date "+%H%M").$(date "+%S") -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
ARG INCLUDE_SPEEDTEST
ARG INCLUDE_AUDIO_TOOLS
ARG INCLUDE_NETCAT
WORKDIR /App
COPY --from=build /src/out .
COPY --from=build /src/TeleBotService.sh .
RUN chmod +x ./TeleBotService.sh
RUN mkdir ./local-config
RUN if [ "${INCLUDE_SPEEDTEST}" = "yes" ]; then \
apt-get update \
&& apt-get install -y curl \
&& curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash \
&& apt-get install -y speedtest; \
fi
RUN if [ "${INCLUDE_AUDIO_TOOLS}" = "yes" ]; then \
apt-get install -y --no-install-recommends alsa-utils && apt-get install -y --no-install-recommends opus-tools && apt-get install -y --no-install-recommends ffmpeg; \
fi
RUN if [ "${INCLUDE_NETCAT}" = "yes" ]; then \
apt-get install -y netcat-traditional; \
fi
ENTRYPOINT ["./TeleBotService.sh"]