chore: fotmat and optimize Dockerfiles
This commit is contained in:
parent
48221d5d18
commit
b33722286a
|
@ -9,34 +9,36 @@ RUN apt-get update && \
|
|||
COPY docker-archive-keyring.gpg /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
COPY docker.list /etc/apt/sources.list.d/docker.list
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
# 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
|
||||
|
@ -49,11 +51,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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue