Skip to content

Commit

Permalink
move some parts into base image (like locales)
Browse files Browse the repository at this point in the history
updated versions:
- ubuntu 20.04 and 22.04:
  - golang (1.20.9 - also fix arguments)
  - pulumi (3.87.0)
- ubuntu 22.04:
  - .NET SDK (7.0.401)
  - pwsh (7.3.7)
  • Loading branch information
mauwii committed Oct 8, 2023
1 parent c21efe2 commit 7895815
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 43 deletions.
41 changes: 22 additions & 19 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -42,42 +42,34 @@ variable "BICEP_VERSION" {
default = "v0.21.1"
}

variable "DOTNET_SDK_VERSION" {
default = "6.0.414"
}

variable "DEPENDENCIES" {
default = "[\"acl\",\"apt-transport-https\",\"aria2\",\"bison\",\"brotli\",\"dbus\",\"dnsutils\",\"fakeroot\",\"flex\",\"fonts-noto-color-emoji\",\"ftp\",\"gawk\",\"gnupg-agent\",\"gnupg2\",\"haveged\",\"iproute2\",\"iputils-ping\",\"libc++-dev\",\"libc++abi-dev\",\"libc6-dev\",\"libgbm-dev\",\"libgconf-2-4\",\"libgsl-dev\",\"libgtk-3-0\",\"libmagic-dev\",\"libsecret-1-dev\",\"libssl-dev\",\"libunwind8\",\"libxkbfile-dev\",\"libxss1\",\"libyaml-dev\",\"lz4\",\"mediainfo\",\"net-tools\",\"netcat\",\"p7zip-full\",\"p7zip-rar\",\"parallel\",\"pass\",\"patchelf\",\"pigz\",\"pollinate\",\"python-is-python3\",\"rpm\",\"rsync\",\"shellcheck\",\"software-properties-common\",\"sphinxsearch\",\"sqlite3\",\"ssh\",\"sshpass\",\"subversion\",\"sudo\",\"swig\",\"telnet\",\"texinfo\",\"time\",\"tk\",\"unzip\",\"upx\",\"xorriso\",\"xvfb\",\"xz-utils\",\"zip\",\"zstd\",\"zsync\"]"
}

variable "GO_VERSION" {
default = "1.20.8"
variable "GOLANG_SHA256_amd64" {
default = "8921369701afa749b07232d2c34d514510c32dbfd79c65adb379451b5f0d7216"
}

variable "GOLANG_GITHUB_SHA256_amd64" {
default = "cc97c28d9c252fbf28f91950d830201aa403836cbed702a05932e63f7f0c7bc4"
variable "GOLANG_SHA256_arm64" {
default = "da7fca78f85b90b495382cd74b2d0a1c0b6aaa200e7feb27ae7198352b2317fa"
}

variable "GOLANG_GITHUB_SHA256_arm64" {
default = "15ab379c6a2b0d086fe3e74be4599420e66549edf7426a300ee0f3809500f89e"
variable "GOLANG_VERSION" {
default = "1.20.9"
}

variable "NODE_VERSION" {
default = "20"
}

variable "PULUMI_VERSION" {
default = "3.86.0"
default = "3.87.0"
}

variable "POWERSHELL_AZ_MODULE_VERSIONS" {
default = "[\"9.3.0\"]"
}

variable "POWERSHELL_VERSION" {
default = "7.2.13"
}

variable "POWERSHELL_MODULES" {
default = "[\"MarkdownPS\",\"Microsoft.Graph\",\"Pester\",\"PSScriptAnalyzer\"]"
}
Expand All @@ -97,11 +89,19 @@ target "ubuntu" {
major = "22"
minor = "04"
codename = "jammy"
DOTNET_CHANNEL = "STS"
DOTNET_DEPS = "[\"libicu70\",\"libssl3\",\"libunwind8\"]"
DOTNET_SDK_VERSION = "7.0.401"
POWERSHELL_VERSION = "7.3.7"
},
{
major = "20"
minor = "04"
codename = "focal"
DOTNET_CHANNEL = "LTS"
DOTNET_DEPS = "[\"libicu66\",\"libssl1.1\"]"
DOTNET_SDK_VERSION = "6.0.414"
POWERSHELL_VERSION = "7.2.13"
}
]
}
Expand All @@ -110,16 +110,19 @@ target "ubuntu" {
CODENAME = release.codename
DEPENDENCIES = DEPENDENCIES
DISTRO = "ubuntu"
DOTNET_SDK_VERSION = DOTNET_SDK_VERSION
DOTNET_CHANNEL = release.DOTNET_CHANNEL
DOTNET_DEPS = release.DOTNET_DEPS
DOTNET_SDK_VERSION = release.DOTNET_SDK_VERSION
FROM_IMAGE = FROM_IMAGE
FROM_VERSION_MAJOR = release.major
FROM_VERSION_MINOR = release.minor
GO_VERSION = GO_VERSION
GOLANG_GITHUB_SHA256_amd64 = GOLANG_GITHUB_SHA256_amd64
GOLANG_GITHUB_SHA256_arm64 = GOLANG_GITHUB_SHA256_arm64
GOLANG_SHA256_amd64 = GOLANG_SHA256_amd64
GOLANG_SHA256_arm64 = GOLANG_SHA256_arm64
GOLANG_VERSION = GOLANG_VERSION
NODE_VERSION = NODE_VERSION
POWERSHELL_AZ_MODULE_VERSIONS = POWERSHELL_AZ_MODULE_VERSIONS
POWERSHELL_MODULES = POWERSHELL_MODULES
POWERSHELL_VERSION = release.POWERSHELL_VERSION
PULUMI_VERSION = PULUMI_VERSION
TOOL_PATH_PWSH = "/usr/share/powershell"
}
Expand Down
49 changes: 25 additions & 24 deletions linux/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ ARG FROM_VERSION_MINOR=04
ARG FROM_VERSION=${FROM_VERSION_MAJOR}.${FROM_VERSION_MINOR}
FROM ${FROM_IMAGE}:${FROM_VERSION} as base

# Force apt to not be interactive/not ask
ENV DEBIAN_FRONTEND=noninteractive

# Configure apt to always assume Y
RUN echo "APT::Get::Assume-Yes \"true\";" >/etc/apt/apt.conf.d/90assumeyes

# set locale
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
locales \
&& rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
RUNNER_MANUALLY_TRAP_SIG=1 \
ACTIONS_RUNNER_PRINT_LOG_TO_STDOUT=1

FROM base as golang
ARG TARGETARCH
SHELL [ "/bin/bash", "--login", "-e", "-o", "pipefail", "-c" ]
Expand Down Expand Up @@ -54,25 +73,6 @@ ARG FROM_VERSION_MINOR=04
ARG FROM_VERSION=${FROM_VERSION_MAJOR}.${FROM_VERSION_MINOR}
ARG DISTRO=ubuntu

# Force apt to not be interactive/not ask
ENV DEBIAN_FRONTEND=noninteractive

# Configure apt to always assume Y
RUN echo "APT::Get::Assume-Yes \"true\";" >/etc/apt/apt.conf.d/90assumeyes

# set locale
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
locales \
&& rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
RUNNER_MANUALLY_TRAP_SIG=1 \
ACTIONS_RUNNER_PRINT_LOG_TO_STDOUT=1

# enable pipefail and set workdir
SHELL [ "/bin/bash", "--login", "-e", "-o", "pipefail", "-c" ]
WORKDIR /tmp
Expand Down Expand Up @@ -154,7 +154,9 @@ RUN echo "deb https://packages.microsoft.com/ubuntu/$(lsb_release -rs)/prod $(ls
&& rm -rf /var/lib/apt/lists/*

# Set .NET related environment variables
ARG DOTNET_SDK_VERSION=6.0.414
ARG DOTNET_SDK_VERSION=latest
ARG DOTNET_CHANNEL=STS
ARG DOTNET_DEPS
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \
DOTNET_GENERATE_ASPNET_CERTIFICATE=false \
DOTNET_HOST_PATH=${AGENT_TOOLSDIRECTORY}/dotnet/dotnet \
Expand All @@ -168,18 +170,17 @@ ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \
NUGET_PACKAGES=${AGENT_TOOLSDIRECTORY}/nugetpackages \
PATH=${AGENT_TOOLSDIRECTORY}/dotnet/tools:${AGENT_TOOLSDIRECTORY}/dotnet:${PATH}

# install .NET SDK LTS
# install .NET SDK
RUN printf "Package: *net*\nPin: origin packages.microsoft.com\nPin-Priority: 1001\n" >/etc/apt/preferences.d/dotnet \
&& deps=("libc6" "libgcc1" "libgssapi-krb5-2" "libstdc++6" "zlib1g") \
&& if [ "${FROM_VERSION}" = "20.04" ]; then deps+=("libicu66" "libssl1.1"); fi \
&& if [ "${FROM_VERSION}" = "22.04" ]; then deps+=("libicu70" "libssl3" "libunwind8"); fi \
&& while IFS='' read -r dep; do deps+=("$dep"); done < <(echo "${DOTNET_DEPS}" | jq -r '.[]') \
&& apt-get -y update &>/dev/null \
&& apt-get -y install --no-install-recommends \
"${deps[@]}" \
&& curl -fsSL https://dot.net/v1/dotnet-install.sh | bash -s -- \
--install-dir "${DOTNET_ROOT}" \
--no-path \
--channel LTS \
--channel "${DOTNET_CHANNEL}" \
--version "${DOTNET_SDK_VERSION}" \
&& rm -rf /etc/apt/preferences.d/dotnet \
&& sed "s|^PATH=|PATH=${DOTNET_ROOT}:|mg" -i /etc/environment \
Expand Down

0 comments on commit 7895815

Please sign in to comment.