Simplify generation Docker image

This commit is contained in:
Jesús 2021-03-09 15:34:14 -05:00
parent df917a69fc
commit 37157b2e55
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766
3 changed files with 21 additions and 51 deletions

View File

@ -1,27 +1,15 @@
FROM scratch FROM scratch
MAINTAINER Jesus E.
# Set the $architecture ARG on your `docker build' command line with `--build-arg architecture=x86_64' or `i686'.
ARG architecture
ADD bootstrap.tar.gz / ADD bootstrap.tar.gz /
RUN \ RUN ldconfig
# First
pacman-key --init \ RUN pacman-key --init && pacman-key --populate archlinux hyperbola
&& pacman-key --populate archlinux hyperbola \
# Another bit of a hack, until Hyperbola bootstrap tarballs start including `sed' package, which is required by RUN pacman -Su --noconfirm --noprogressbar --quiet gzip awk
# `rankmirrors', which comes with `pacman' package, while that one doesn't depend on `sed'. (Note to self: ask the
# Hyperbola devs about this; `locale-gen' uses `sed' too). Again, lucky it has very little deps. RUN pacman -Scc --noconfirm && paccache -r -k0
&& sed -i "s/^Architecture = auto$/Architecture = $architecture/" /etc/pacman.conf \
# `locale-gen' needs `gzip' (via `localedef', which works on /usr/share/i18n/charmaps/*.gz), `paccache' needs `awk'.
# Update the system BTW.
&& pacman -Su --noconfirm --noprogressbar --quiet gzip awk \
# Remove the last leftovers of the initial dirty `haveged' install.
&& paccache -r -k0 \
&& echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen \
&& locale-gen \
&& echo 'LANG=en_US.UTF-8' > /etc/locale.conf \
&& pacman -Scc --noconfirm
ENV LANG en_US.UTF-8 ENV LANG en_US.UTF-8
CMD ["/bin/bash"]

View File

@ -1,27 +1,15 @@
FROM scratch FROM scratch
MAINTAINER Jesus E.
# Set the $architecture ARG on your `docker build' command line with `--build-arg architecture=x86_64' or `i686'.
ARG architecture
ADD bootstrap.tar.gz / ADD bootstrap.tar.gz /
RUN \ RUN ldconfig
# First
pacman-key --init \ RUN pacman-key --init && pacman-key --populate hyperbola
&& pacman-key --populate hyperbola \
# Another bit of a hack, until Hyperbola bootstrap tarballs start including `sed' package, which is required by RUN pacman -Su --noconfirm --noprogressbar --quiet gzip awk
# `rankmirrors', which comes with `pacman' package, while that one doesn't depend on `sed'. (Note to self: ask the
# Hyperbola devs about this; `locale-gen' uses `sed' too). Again, lucky it has very little deps. RUN pacman -Scc --noconfirm && paccache -r -k0
&& sed -i "s/^Architecture = auto$/Architecture = $architecture/" /etc/pacman.conf \
# `locale-gen' needs `gzip' (via `localedef', which works on /usr/share/i18n/charmaps/*.gz), `paccache' needs `awk'.
# Update the system BTW.
&& pacman -Su --noconfirm --noprogressbar --quiet gzip awk \
# Remove the last leftovers of the initial dirty `haveged' install.
&& paccache -r -k0 \
&& echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen \
&& locale-gen \
&& echo 'LANG=en_US.UTF-8' > /etc/locale.conf \
&& pacman -Scc --noconfirm
ENV LANG en_US.UTF-8 ENV LANG en_US.UTF-8
CMD ["/bin/bash"]

View File

@ -16,25 +16,19 @@ Usage
- Generate bootstrap image with [hyperbola-bootstrap](https://git.sr.ht/~heckyel/hyperbola-bootstrap) - Generate bootstrap image with [hyperbola-bootstrap](https://git.sr.ht/~heckyel/hyperbola-bootstrap)
- Run - Converter hyperbola-bootstrap to bootstrap image valid for docker
./tar_fix.py --input=hyperbola-bootstrap.tar.gz --output=bootstrap.tar.gz ./tar_fix.py --input=hyperbola-bootstrap.tar.gz --output=bootstrap.tar.gz
> This will remove input tarball's top-level directory from all its component paths, and save that in the output tarball.
> As a result its content starts at `/` rather than `x86_64/` or `i686/`, and so will the filesystem of the Docker image.
> `tar_fix.py` needs Python 3.5 or later.
- Make sure you have my `Dockerfile`, `.dockerignore` and the `bootstrap.tar.gz` in one directory. - Make sure you have my `Dockerfile`, `.dockerignore` and the `bootstrap.tar.gz` in one directory.
- Build the image with a command like: - Build the image with a command like:
docker build --build-arg architecture=x86_64 --tag hyperbola:0.4 -f Dockerfile-Hyperbola-v04 . docker build --tag hyperbola:0.4 -f Dockerfile-Hyperbola-v04 .
or for Hyperbola Milky Way v0.3 or for Hyperbola Milky Way v0.3
docker build --build-arg architecture=x86_64 --tag hyperbola:0.3 -f Dockerfile-Hyperbola-v03 . docker build --tag hyperbola:0.3 -f Dockerfile-Hyperbola-v03 .
> **Mind the dot!** Use `--build-arg architecture=i686` if you are building from an i686 `bootstrap.tar.gz`.
License License
======= =======