forked from googleapis/gapic-generator-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
33 lines (26 loc) · 1.34 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
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 as sdk
# Add dotnet (C#) generator source.
COPY . /usr/src/gapic-generator-csharp/
# Build generator native binary.
RUN cd /usr/src/gapic-generator-csharp/Google.Api.Generator; \
dotnet publish -c Release --self-contained --runtime linux-x64; \
chmod 0777 bin/Release/netcoreapp2.2/linux-x64/publish/Google.Api.Generator
# Build smaller runtime image.
# The generator executable just built is stand-alone, so dotnet is not required in the OS image.
# Cannot use latest debian, as libssl is the wrong version.
FROM debian:jessie-slim
RUN apt-get -y update
RUN apt-get -y install openssl
# Add protoc and our common protos.
COPY --from=gcr.io/gapic-images/api-common-protos:1.50.0 /usr/local/bin/protoc /usr/local/bin/protoc
COPY --from=gcr.io/gapic-images/api-common-protos:1.50.0 /protos/ /protos/
# Add C# generator binaries.
COPY --from=sdk \
/usr/src/gapic-generator-csharp/Google.Api.Generator/bin/Release/netcoreapp2.2/linux-x64/publish \
/usr/src/gapic-generator-csharp/Google.Api.Generator/bin/Release/netcoreapp2.2/linux-x64/publish
# Add entrypoint script.
COPY --from=sdk \
/usr/src/gapic-generator-csharp/docker-entrypoint.sh \
/usr/src/gapic-generator-csharp/docker-entrypoint.sh
# Define the generator as an entry point.
ENTRYPOINT ["/usr/src/gapic-generator-csharp/docker-entrypoint.sh"]