forked from SebastianStehle/MongoBackup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (22 loc) · 879 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
33
34
35
36
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster as builder
WORKDIR /MongoBackup
# Build Step 1: Install packages
COPY MongoBackup/MongoBackup.csproj .
RUN dotnet restore
# Build Step 2: Create publish artifact
COPY . .
RUN dotnet publish -c release -o /out/
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim
# Install wget
RUN apt-get update \
&& apt-get install -y gnupg ca-certificates wget
RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add -
RUN echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list
# Install mongodb binaries
RUN apt-get update \
&& apt-get install -y mongodb-org-tools
# Set the path to the mongodump
ENV MongoDB__DumpBinaryPath /usr/bin/mongodump
WORKDIR /app/
COPY --from=builder /out/ .
CMD ["dotnet", "./MongoBackup.dll"]