Last active
October 4, 2021 11:23
-
-
Save cdhunt/9afb859d5ad2ff18beed0709b1f05521 to your computer and use it in GitHub Desktop.
CircleCI build image with Dotnet SDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:20.04 | |
RUN apt-get update && apt-get install -y wget | |
RUN wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \ | |
dpkg -i packages-microsoft-prod.deb && \ | |
rm packages-microsoft-prod.deb | |
RUN apt-get update && apt-get install -y \ | |
apt-transport-https \ | |
dotnet-sdk-5.0 | |
# Configure environment | |
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci && \ | |
echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci && \ | |
apt-get update && apt-get install -y \ | |
curl \ | |
locales \ | |
sudo \ | |
&& \ | |
locale-gen en_US.UTF-8 && \ | |
rm -rf /var/lib/apt/lists/* && \ | |
useradd --uid=3434 --user-group --create-home circleci && \ | |
echo 'circleci ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-circleci && \ | |
echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep && \ | |
sudo -u circleci mkdir /home/circleci/project && \ | |
# Install Dockerize v0.6.1 | |
# Source repo: https://github.com/jwilder/dockerize | |
# I (Ricardo) would like to replace this one day. It's a tool not really | |
# maintained and we can likely offer something better. | |
curl -sSL --fail --retry 3 --output /tmp/dockerize-linux-amd64.tar.gz "https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/dockerize-latest.tar.gz" && \ | |
tar -C /usr/local/bin -xzvf /tmp/dockerize-linux-amd64.tar.gz && \ | |
rm -rf /tmp/dockerize-linux-amd64.tar.gz && \ | |
# Quick test of Dockerize | |
dockerize --version | |
ENV PATH=/home/circleci/bin:/home/circleci/.local/bin:$PATH \ | |
LANG=en_US.UTF-8 \ | |
LANGUAGE=en_US:en \ | |
LC_ALL=en_US.UTF-8 | |
RUN apt-get update && apt-get install -y \ | |
autoconf \ | |
build-essential \ | |
ca-certificates \ | |
# already installed but here for consistency | |
curl \ | |
gnupg \ | |
gzip \ | |
jq \ | |
# popular DB lib - MariaDB | |
libmariadb-dev \ | |
# allows MySQL users to use MariaDB lib | |
libmariadb-dev-compat \ | |
# popular DB lib - PostgreSQL | |
libpq-dev \ | |
make \ | |
# for ssh-enabled builds | |
nano \ | |
net-tools \ | |
netcat \ | |
openssh-client \ | |
parallel \ | |
# compiling tool | |
pkg-config \ | |
software-properties-common \ | |
# already installed but hear for consistency | |
sudo \ | |
tar \ | |
tzdata \ | |
unzip \ | |
# for ssh-enabled builds | |
vim-tiny \ | |
wget \ | |
zip && \ | |
add-apt-repository ppa:git-core/ppa && apt-get install -y git && \ | |
rm -rf /var/lib/apt/lists/* | |
# Install Docker - needs the setup_remote_docker CircleCI step to work | |
ENV DOCKER_VERSION 5:20.10.8~3-0~ubuntu- | |
RUN apt-get update && apt-get install -y \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg-agent \ | |
software-properties-common && \ | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ | |
add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \ | |
apt-get install -y docker-ce=${DOCKER_VERSION}$(lsb_release -cs) docker-ce-cli=${DOCKER_VERSION}$(lsb_release -cs) containerd.io && \ | |
# Quick test of the Docker install | |
docker --version && \ | |
rm -rf /var/lib/apt/lists/* | |
# Install Docker Compose - see prerequisite above | |
ENV COMPOSE_VERSION 1.29.2 | |
RUN curl -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \ | |
chmod +x /usr/local/bin/docker-compose && \ | |
# Quick test of the Docker Compose install | |
docker-compose version | |
RUN wget "https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64.tar.gz" -O - | \ | |
tar -xz && \ | |
mv yq_linux_amd64 /usr/local/bin/yq | |
USER circleci | |
# Match the default CircleCI working directory | |
WORKDIR /home/circleci/project |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment