Skip to content

Commit

Permalink
Fixing the docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyzimarev committed Oct 12, 2021
1 parent 6711d6e commit 3896543
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 34 deletions.
38 changes: 4 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,20 @@
ARG PULUMI_IMAGE=pulumi/pulumi-base
FROM ${PULUMI_IMAGE}:${PULUMI_VERSION} as pulumi

# Build container
FROM ubuntu:bionic AS builder
WORKDIR /dotnet
RUN apt-get update -y && \
apt-get install -y \
curl \
gpg
RUN curl -o - https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/microsoft.asc.gpg; \
curl -o /tmp/microsoft-prod.list https://packages.microsoft.com/config/debian/10/prod.list

FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
COPY . .
RUN dotnet publish ./Ubiquitous.AutoDevOps -c Release -r linux-x64 --no-self-contained -clp:NoSummary -o /app/publish \
/p:PublishReadyToRun=true,PublishSingleFile=false
RUN dotnet publish ./Ubiquitous.AutoDevOps -c Release -r linux-x64 --self-contained -clp:NoSummary -o /app/publish

# The runtime container
FROM debian:buster-slim
WORKDIR /pulumi/projects

ARG RUNTIME_VERSION="5.0"

# We need to install ca certs before copying the ms prod debs packages
RUN --mount=target=/var/lib/apt/lists,type=cache \
--mount=target=/var/cache/apt,type=cache \
apt-get update -y && \
apt-get install -y \
ca-certificates

COPY --from=builder /tmp/microsoft.asc.gpg /etc/apt/trusted.gpg.d/microsoft.asc.gpg
COPY --from=builder /tmp/microsoft-prod.list /etc/apt/sources.list.d/microsoft-prod.list

# Install needed tools, like git
RUN --mount=target=/var/lib/apt/lists,type=cache \
--mount=target=/var/cache/apt,type=cache \
apt-get update -y && \
apt-get install -y \
git \
dotnet-sdk-${RUNTIME_VERSION}

# Uses the workdir, copies from pulumi interim container
COPY --from=pulumi /pulumi/bin/pulumi /pulumi/bin/pulumi
COPY --from=pulumi /pulumi/bin/*-dotnet* /pulumi/bin/
ENV PATH "/pulumi/bin:${PATH}"

WORKDIR /app
COPY --from=build /app/publish .
CMD ["Ubiquitous.AutoDevOps"]
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
CMD ["./Ubiquitous.AutoDevOps"]
1 change: 1 addition & 0 deletions Ubiquitous.AutoDevOps/Ubiquitous.AutoDevOps.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 3896543

Please sign in to comment.