docker stuff
This commit is contained in:
parent
cadbb2ae01
commit
6027f2db5a
2 changed files with 87 additions and 5 deletions
66
Dockerfile
66
Dockerfile
|
@ -1,10 +1,42 @@
|
||||||
# https://hub.docker.com/_/microsoft-dotnet-core
|
# https://hub.docker.com/_/microsoft-dotnet-core
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
|
#FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
|
||||||
|
# FROM alpine AS build
|
||||||
|
#ARG REPO=mcr.microsoft.com/dotnet/aspnet
|
||||||
|
#FROM $REPO:5.0-alpine3.12-amd64
|
||||||
|
|
||||||
WORKDIR /installer
|
#ENV \
|
||||||
COPY ./dotnet-install.sh ./dotnet-install.sh
|
# # Unset ASPNETCORE_URLS from aspnet base image
|
||||||
RUN chmod +x dotnet-install.sh
|
# ASPNETCORE_URLS= \
|
||||||
RUN ./dotnet-install.sh --channel 3.1
|
# DOTNET_SDK_VERSION=5.0.100 \
|
||||||
|
# # Disable the invariant mode (set in base image)
|
||||||
|
# DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
|
||||||
|
# # Enable correct mode for dotnet watch (only mode supported in a container)
|
||||||
|
# DOTNET_USE_POLLING_FILE_WATCHER=true \
|
||||||
|
# # Skip extraction of XML docs - generally not useful within an image/container - helps performance
|
||||||
|
# NUGET_XMLDOC_MODE=skip \
|
||||||
|
# # PowerShell telemetry for docker image usage
|
||||||
|
# POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-DotnetSDK-Alpine-3.12##
|
||||||
|
|
||||||
|
#RUN apk add --no-cache \
|
||||||
|
# curl \
|
||||||
|
# icu-libs \
|
||||||
|
# wget \
|
||||||
|
# git \
|
||||||
|
# bash
|
||||||
|
#
|
||||||
|
#WORKDIR /installer
|
||||||
|
#RUN wget https://dot.net/v1/dotnet-install.sh
|
||||||
|
##COPY ./dotnet-install.sh ./dotnet-install.sh
|
||||||
|
#RUN chmod +x dotnet-install.sh
|
||||||
|
#RUN ./dotnet-install.sh --channel 3.1
|
||||||
|
#RUN ./dotnet-install.sh --channel 5.0
|
||||||
|
#RUN export PATH=~/.dotnet:$PATH
|
||||||
|
#RUN export DOTNET_ROOT=~/.dotnet
|
||||||
|
#RUN export PATH=$PATH:~/.dotnet
|
||||||
|
##ENV PATH="${PATH}:~/.dotnet"
|
||||||
|
#ENV PATH="~/.dotnet:${PATH}"
|
||||||
|
|
||||||
|
#RUN which dotnet
|
||||||
# # Install .NET CLI dependencies
|
# # Install .NET CLI dependencies
|
||||||
# RUN apt-get update \
|
# RUN apt-get update \
|
||||||
# && apt-get install -y --no-install-recommends \
|
# && apt-get install -y --no-install-recommends \
|
||||||
|
@ -28,6 +60,30 @@ RUN ./dotnet-install.sh --channel 3.1
|
||||||
# && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
|
# && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
|
||||||
# # Trigger first run experience by running arbitrary cmd
|
# # Trigger first run experience by running arbitrary cmd
|
||||||
# && dotnet help
|
# && dotnet help
|
||||||
|
FROM ubuntu:groovy as build
|
||||||
|
RUN export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
&& apt-get update \
|
||||||
|
# Install prerequisites
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
wget \
|
||||||
|
ca-certificates \
|
||||||
|
\
|
||||||
|
# Install Microsoft package feed
|
||||||
|
&& wget -q https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
|
||||||
|
&& dpkg -i packages-microsoft-prod.deb \
|
||||||
|
&& rm packages-microsoft-prod.deb \
|
||||||
|
\
|
||||||
|
# Install .NET
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
dotnet-sdk-5.0 \
|
||||||
|
dotnet-sdk-3.1 \
|
||||||
|
libpng12 \
|
||||||
|
\
|
||||||
|
# Cleanup
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# copy csproj and restore as distinct layers
|
# copy csproj and restore as distinct layers
|
||||||
|
|
26
Dockerfile2
Normal file
26
Dockerfile2
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# https://hub.docker.com/_/microsoft-dotnet-core
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
# copy csproj and restore as distinct layers
|
||||||
|
COPY Sledgemapper.Api/*.csproj ./Sledgemapper.Api/
|
||||||
|
COPY Sledgemapper.Shared/*.csproj ./Sledgemapper.Shared/
|
||||||
|
|
||||||
|
WORKDIR /src/Sledgemapper.Api
|
||||||
|
RUN dotnet restore
|
||||||
|
|
||||||
|
WORKDIR /src/Sledgemapper.Shared
|
||||||
|
RUN dotnet restore
|
||||||
|
|
||||||
|
# copy everything else and build app
|
||||||
|
WORKDIR /src
|
||||||
|
COPY Sledgemapper.Api/. ./Sledgemapper.Api/
|
||||||
|
COPY Sledgemapper.Shared/. ./Sledgemapper.Shared/
|
||||||
|
WORKDIR /src/Sledgemapper.Api
|
||||||
|
RUN dotnet publish -c release -o /app --no-restore
|
||||||
|
|
||||||
|
# final stage/image
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:5.0
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /app ./
|
||||||
|
ENTRYPOINT ["dotnet", "Sledgemapper.Api.dll"]
|
Loading…
Add table
Add a link
Reference in a new issue