Skip to content

Commit

Permalink
Improved Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Jun 7, 2024
1 parent c528a7c commit a7a302a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
5 changes: 3 additions & 2 deletions .run/Dockerfile.run.xml → .run/docker_Dockerfile.run.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<configuration default="false" name="docker/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="dotnetsdk:latest" />
<option name="containerName" value="" />
<option name="sourceFilePath" value="Dockerfile" />
<option name="sourceFilePath" value="docker/Dockerfile" />
</settings>
</deployment>
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="false" />
Expand Down
24 changes: 0 additions & 24 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion build/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const string image = "dotnetsdk:latest";
const string repoImage = "nikolayp/dotnetsdk:latest";

new DockerCustom("build", "-t", image, ".").TryRun();
new DockerCustom("build", "-t", image, "docker").TryRun();
new DockerCustom("login").TryRun();
new DockerCustom("tag", image, repoImage).TryRun();
new DockerCustom("image", "push", repoImage).TryRun();
24 changes: 24 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-jammy

# Docker
RUN apt-get update \
&& apt-get -y install ca-certificates curl \
&& install -m 0755 -d /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc \
&& chmod a+r /etc/apt/keyrings/docker.asc \
&& echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update && apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# .NET
RUN curl -LO https://dot.net/v1/dotnet-install.sh --output ./dotnet-install.sh \
&& chmod +x ./dotnet-install.sh \
&& ./dotnet-install.sh --channel 8.0 \
&& ./dotnet-install.sh --channel 7.0 --runtime aspnetcore \
&& ./dotnet-install.sh --channel 6.0 --runtime aspnetcore \
&& rm ./dotnet-install.sh

ENV DOTNET_ROOT=/root/.dotnet
ENV PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools

0 comments on commit a7a302a

Please sign in to comment.