chore: format and optimize Dockerfiles (#256)

This commit is contained in:
Muhammad Atif Ali 2024-01-17 13:33:24 +03:00 committed by GitHub
parent b283c60b6c
commit c35ef22abf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 44 deletions

View File

@ -1,42 +1,45 @@
FROM ubuntu:22.04 FROM ubuntu:22.04
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND noninteractive
# Install the Docker apt repository # Install the Docker apt repository
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get upgrade --yes && \ apt-get upgrade --yes && \
DEBIAN_FRONTEND="noninteractive" apt-get install --yes ca-certificates apt-get install --yes ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY docker-archive-keyring.gpg /usr/share/keyrings/docker-archive-keyring.gpg COPY docker-archive-keyring.gpg /usr/share/keyrings/docker-archive-keyring.gpg
COPY docker.list /etc/apt/sources.list.d/docker.list COPY docker.list /etc/apt/sources.list.d/docker.list
# Install baseline packages # Install baseline packages
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install --yes \ apt-get install --yes \
bash \ bash \
build-essential \ build-essential \
ca-certificates \ ca-certificates \
containerd.io \ containerd.io \
curl \ curl \
docker-ce \ docker-ce \
docker-ce-cli \ docker-ce-cli \
docker-buildx-plugin \ docker-buildx-plugin \
docker-compose-plugin \ docker-compose-plugin \
htop \ htop \
locales \ locales \
man \ man \
python3 \ python3 \
python3-pip \ python3-pip \
software-properties-common \ software-properties-common \
sudo \ sudo \
systemd \ systemd \
systemd-sysv \ systemd-sysv \
unzip \ unzip \
vim \ vim \
wget \ wget \
rsync && \ rsync && \
# Install latest Git using their official PPA # Install latest Git using their official PPA
add-apt-repository ppa:git-core/ppa && \ add-apt-repository ppa:git-core/ppa && \
DEBIAN_FRONTEND="noninteractive" apt-get install --yes git apt-get install --yes git \
&& rm -rf /var/lib/apt/lists/*
# Enables Docker starting with systemd # Enables Docker starting with systemd
RUN systemctl enable docker RUN systemctl enable docker
@ -49,11 +52,11 @@ ENV LANG en_US.UTF-8
# Add a user `coder` so that you're not developing as the `root` user # Add a user `coder` so that you're not developing as the `root` user
RUN useradd coder \ RUN useradd coder \
--create-home \ --create-home \
--shell=/bin/bash \ --shell=/bin/bash \
--groups=docker \ --groups=docker \
--uid=1000 \ --uid=1000 \
--user-group && \ --user-group && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd
USER coder USER coder

View File

@ -1 +0,0 @@
Server=https://archive.archlinux.org/repos/2021/02/01/$repo/os/$arch

View File

@ -4,20 +4,18 @@ USER root
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
bash \ bash \
ca-certificates \ ca-certificates \
curl \ curl \
git \ git \
sudo sudo \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN useradd coder \ RUN useradd coder \
--create-home \ --create-home \
--shell=/bin/bash \ --shell=/bin/bash \
--uid=1000 \ --uid=1000 \
--user-group && \ --user-group && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd
ENV LANG en_US.UTF-8 ENV LANG en_US.UTF-8