Skip to content

Instantly share code, notes, and snippets.

@fredrikhr
Last active June 24, 2020 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredrikhr/6cae577fcedba6311402c7e4ccefc021 to your computer and use it in GitHub Desktop.
Save fredrikhr/6cae577fcedba6311402c7e4ccefc021 to your computer and use it in GitHub Desktop.
GoogleOrToolsDotnetCore
# docker build -t fredrikhr/googleortools-tsp-sample-dotnetcore -f GoogleOrToolsDotnetCore.dockerfile https://gist.github.com/6cae577fcedba6311402c7e4ccefc021.git
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic AS build
WORKDIR /app/GoogleOrToolsDotnetCore
# Install curl
RUN set -x \
# APT Update & Upgrade
&& apt-get update \
&& apt-get upgrade --yes 2>&1 \
&& apt-get install --yes --no-install-recommends \
apt-transport-https \
curl \
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
RUN dotnet new console
RUN dotnet add package Google.OrTools --version 7.7.7816
RUN rm -v Program.cs \
&& curl -LORJ "https://github.com/google/or-tools/raw/stable/ortools/constraint_solver/samples/Tsp.cs" 2>&1
RUN dotnet build -c Release
RUN dotnet publish -c Release -r linux-x64 --no-self-contained
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-bionic
COPY --from=build /app/GoogleOrToolsDotnetCore/bin/Release/netcoreapp3.1/linux-x64/publish/ /app/GoogleOrToolsDotnetCore
CMD [ "/app/GoogleOrToolsDotnetCore/GoogleOrToolsDotnetCore" ]
# docker run -it --rm fredrikhr/googleortools-tsp-sample-dotnetcore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment