Skip to content

Commit

Permalink
Revert "test to shrink base image"
Browse files Browse the repository at this point in the history
This reverts commit 00533ee.
  • Loading branch information
Locietta committed Sep 13, 2023
1 parent baec268 commit cc16fcf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 382 deletions.
59 changes: 7 additions & 52 deletions dockerfiles/dockerfile
Original file line number Diff line number Diff line change
@@ -1,57 +1,12 @@
FROM archlinux/archlinux:base-devel as arch
LABEL maintainer="<[email protected]>"
FROM archlinux/archlinux:base-devel
LABEL maintainer="[email protected]"

RUN sudo pacman-key --init

RUN pacman -Syu --needed --noconfirm git

# add archlinuxcn repo
RUN echo $'[archlinuxcn]\n\
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch\n\
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch' >> /etc/pacman.conf\
&& pacman -Sy --noconfirm archlinuxcn-keyring \
&& pacman-key --populate archlinuxcn

# create AUR user
ARG user=aur
RUN useradd --create-home $user \
&& echo "$user ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/$user
USER $user
WORKDIR /home/$user

# build pacman-static
COPY ./pacman-static.PKGBUILD /home/$user/PKGBUILD
RUN git clone https://aur.archlinux.org/pacman-static.git --depth 1 \
&& cd pacman-static \
&& mv ../PKGBUILD . \
&& makepkg -si --needed --noconfirm --skippgpcheck\
&& cd

# build gpg
RUN git clone https://github.com/skeeto/lean-static-gpg gnupg --depth 1
RUN cd gnupg && ./build.sh

USER root

FROM debian:unstable-slim as debian

RUN apt-get update && apt-get install -y bash-static

FROM scratch

# copy over everything pacman needs
COPY --from=arch /usr/bin/pacman-static /usr/bin/pacman
COPY --from=arch /etc/pacman.conf /etc/pacman.conf
COPY --from=arch /etc/pacman.d /etc/pacman.d
COPY --from=arch /var/lib/pacman/sync /var/lib/pacman/sync
COPY --from=arch /home/aur/gnupg/gnupg/bin/gpg /usr/bin/gpg
COPY --from=arch /etc/ca-certificates/extracted/tls-ca-bundle.pem \
/etc/ssl/certs/ca-certificates.crt

# copy over bash-static from debian
COPY --from=debian /bin/bash-static /usr/bin/bash

# set shell path
SHELL ["/usr/bin/bash", "-c"]

CMD ["/usr/bin/bash"]
&& pacman-key --init && pacman-key --populate archlinuxcn\
&& pacman -Syy --noconfirm git python\
&& pacman -Scc --noconfirm && rm -rf /var/cache/pacman/pkg/* && rm -rf /var/lib/pacman/sync/*\
&& rm -rf /usr/share/info/* && rm -rf /usr/share/man/* && rm -rf /usr/share/doc/*\
&& rm -rf /tmp/*
330 changes: 0 additions & 330 deletions pacman-static.PKGBUILD

This file was deleted.

0 comments on commit cc16fcf

Please sign in to comment.