Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: format and optimize Dockerfiles #256

Merged
merged 3 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 34 additions & 31 deletions images/base/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
FROM ubuntu:22.04

SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND noninteractive

# Install the Docker apt repository
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get upgrade --yes && \
DEBIAN_FRONTEND="noninteractive" apt-get install --yes ca-certificates
apt-get upgrade --yes && \
apt-get install --yes ca-certificates && \
rm -rf /var/lib/apt/lists/*
matifali marked this conversation as resolved.
Show resolved Hide resolved
COPY docker-archive-keyring.gpg /usr/share/keyrings/docker-archive-keyring.gpg
COPY docker.list /etc/apt/sources.list.d/docker.list

# Install baseline packages
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install --yes \
bash \
build-essential \
ca-certificates \
containerd.io \
curl \
docker-ce \
docker-ce-cli \
docker-buildx-plugin \
docker-compose-plugin \
htop \
locales \
man \
python3 \
python3-pip \
software-properties-common \
sudo \
systemd \
systemd-sysv \
unzip \
vim \
wget \
rsync && \
apt-get install --yes \
bash \
build-essential \
ca-certificates \
containerd.io \
curl \
docker-ce \
docker-ce-cli \
docker-buildx-plugin \
docker-compose-plugin \
htop \
locales \
man \
python3 \
python3-pip \
software-properties-common \
sudo \
systemd \
systemd-sysv \
unzip \
vim \
wget \
rsync && \
# Install latest Git using their official 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
RUN systemctl enable docker
Expand All @@ -49,11 +52,11 @@ ENV LANG en_US.UTF-8

# Add a user `coder` so that you're not developing as the `root` user
RUN useradd coder \
--create-home \
--shell=/bin/bash \
--groups=docker \
--uid=1000 \
--user-group && \
--create-home \
--shell=/bin/bash \
--groups=docker \
--uid=1000 \
--user-group && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd

USER coder
1 change: 0 additions & 1 deletion images/base/mirrorlist

This file was deleted.

22 changes: 10 additions & 12 deletions images/minimal/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ USER root
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
bash \
ca-certificates \
curl \
git \
sudo

RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
bash \
ca-certificates \
curl \
git \
sudo \
&& rm -rf /var/lib/apt/lists/*

RUN useradd coder \
--create-home \
--shell=/bin/bash \
--uid=1000 \
--user-group && \
--create-home \
--shell=/bin/bash \
--uid=1000 \
--user-group && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd

ENV LANG en_US.UTF-8
Expand Down