-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (25 loc) · 1.09 KB
/
Dockerfile
File metadata and controls
31 lines (25 loc) · 1.09 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
FROM mcr.microsoft.com/dotnet/sdk AS build
WORKDIR /source
# copy csproj and restore as distinct layers
COPY src/WordsBot/*.csproj ./src/WordsBot/
COPY src/WordsBot.Common/*.csproj ./src/WordsBot.Common/
COPY src/WordsBot.Database.Sqlite/*.csproj ./src/WordsBot.Database.Sqlite/
COPY src/WordsBot.Translators.YandexTranslate/*.csproj ./src/WordsBot.Translators.YandexTranslate/
COPY tests/WordsBot.Common.Test/*.csproj ./tests/WordsBot.Common.Test/
COPY tests/WordsBot.Translators.YandexTranslateTest/*.csproj ./tests/WordsBot.Translators.YandexTranslateTest/
COPY *.sln .
RUN dotnet restore
# copy and publish app and libraries
COPY . .
RUN cd src/WordsBot && dotnet publish -c release -o /app --no-restore
# final stage/image
FROM mcr.microsoft.com/dotnet/runtime
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install gosu && apt purge -y --autoremove && rm /var/lib/apt/lists -rf
RUN groupadd -r wordsbot --gid=1000 && \
useradd -r -g wordsbot --uid=1000 --home-dir=/app wordsbot
WORKDIR /app
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
COPY --from=build /app .
ENTRYPOINT ["/app/entrypoint.sh"]