Skip to content

Commit

Permalink
Merge pull request #11 from AdamIsrael/images
Browse files Browse the repository at this point in the history
Images
  • Loading branch information
castrojo authored Nov 5, 2021
2 parents 323084f + 7d25d25 commit 5302f7c
Show file tree
Hide file tree
Showing 10 changed files with 212 additions and 0 deletions.
31 changes: 31 additions & 0 deletions 99-build-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# build toolbox images
set -eu

# Scan the images we have available

IMAGES=$(find images -type f -name Containerfile | awk -F/ '{printf "%s-%s\n", $2, $3}')

# mapfile -t test $IMAGES

# echo $IMAGES


find images/ -type f -name Containerfile -print0 |
while IFS= read -r -d '' line; do
image=$(echo $line | awk -F/ '{printf "%s-%s\n", $2, $3}')

echo "Building $image..."


# Think about where to redirect the output. Maybe a temp log?

podman build -t $image -f $line > /dev/null


# echo "$line ($image)"
# Error: container debian-sid already exists
echo "To create a container using this image, run:"
echo "toolbox create --image $image -c my-project"

done
8 changes: 8 additions & 0 deletions images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Images

| Distribution | Release | Description |
| -------------| ------- | ----------- |
| Arch | latest | Arch Linux |
| Debian | sid | Debian Sid |
| Ubuntu | 18.04 | Ubuntu 18.04 LTS |
| Ubuntu | 20.04 | Ubuntu 20.04 LTS |
39 changes: 39 additions & 0 deletions images/arch/latest/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Based on the Dockerfile by Emanuele Palazzetti <emanuele.palazzetti@gmail.com>
# https://github.com/palazzem/archlinux-toolbox

FROM docker.io/archlinux:latest

ENV NAME=arch-toolbox VERSION=rolling
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Arch toolbox containers" \
maintainer="Adam Israel <adam@adamisrael.com>"

# Install required dependencies to run `toolbox`
RUN pacman -Sy sudo git --noconfirm && \
pacman -Scc --noconfirm

# COPY extra-packages /
# RUN sed -Ei '/apt-get (update|upgrade)/s/^/#/' /usr/local/sbin/unminimize && \
# apt-get update && \
# yes | /usr/local/sbin/unminimize && \
# DEBIAN_FRONTEND=noninteractive apt-get -y install \
# ubuntu-minimal ubuntu-standard \
# libnss-myhostname \
# $(cat extra-packages | xargs) && \
# rm -rd /var/lib/apt/lists/*
# RUN rm /extra-packages


# Required steps otherwise `toolbox` fails to start the container:
# 1. machine-id must be present in the base image
# 2. $(whoami) must be in the sudoer list without password
# 3. /media must be present (toolbox tries to remove the folder and create a symlink)
RUN touch /etc/machine-id && \
echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/toolbox && \
mkdir /media

CMD /bin/bash
38 changes: 38 additions & 0 deletions images/debian/sid/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM docker.io/library/debian:sid

ENV NAME=debian-toolbox VERSION=sid
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Debian sid toolbox containers" \
maintainer="Adam Israel <adam@adamisrael.com>"

RUN apt-get update && apt-get -y upgrade && \
apt-get -y install \
bash-completion \
git \
keyutils \
libcap2-bin \
lsof \
man-db \
mlocate \
mtr \
rsync \
sudo \
tcpdump \
time \
traceroute \
tree \
unzip \
wget \
zip && \
apt-get clean

RUN sed -i -e 's/ ALL$/ NOPASSWD:ALL/' /etc/sudoers

RUN echo VARIANT_ID=container >> /etc/os-release
RUN touch /etc/localtime

CMD /bin/sh
39 changes: 39 additions & 0 deletions images/ubuntu/18.04/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Originally based on the dockerfile created by Ievgen Popovych <jmennius@gmail.com>

FROM docker.io/library/ubuntu:18.04

LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
name="ubuntu-toolbox" \
version="18.04" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Ubuntu toolbox containers" \
maintainer="Adam Israel <adam@adamisrael.com>"

COPY README.md /

# remove some container-optimized apt configuration;
# removing docker-gzip-indexes specifically helps with command-not-found
RUN rm -f /etc/apt/apt.conf.d/docker-gzip-indexes /etc/apt/apt.conf.d/docker-no-languages

# Restore documentation but do not upgrade all packages, that's not appropriate;
# Install ubuntu-minimal & ubuntu-standard
# Install extra packages as well as libnss-myhostname
COPY extra-packages /
RUN sed -Ei '/apt-get (update|upgrade)/s/^/#/' /usr/local/sbin/unminimize && \
apt-get update && \
yes | /usr/local/sbin/unminimize && \
DEBIAN_FRONTEND=noninteractive apt-get -y install \
ubuntu-minimal ubuntu-standard \
libnss-myhostname \
$(cat extra-packages | xargs) && \
rm -rd /var/lib/apt/lists/*
RUN rm /extra-packages

# Allow authentication with empty password, promptless
RUN sed -i '/^auth.*pam_unix.so/s/nullok_secure/try_first_pass nullok/' /etc/pam.d/common-auth

# Fix empty bind-mount to clear selinuxfs (see #337)
RUN mkdir -p /usr/share/empty

CMD /bin/sh
Empty file added images/ubuntu/18.04/README.md
Empty file.
9 changes: 9 additions & 0 deletions images/ubuntu/18.04/extra-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

git
keyutils
gnupg2
tree
unzip
zip
zsh
curl
39 changes: 39 additions & 0 deletions images/ubuntu/20.04/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Originally based on the dockerfile created by Ievgen Popovych <jmennius@gmail.com>

FROM docker.io/library/ubuntu:20.04

LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
name="ubuntu-toolbox" \
version="20.04" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Ubuntu toolbox containers" \
maintainer="Adam Israel <adam@adamisrael.com>"

COPY README.md /

# remove some container-optimized apt configuration;
# removing docker-gzip-indexes specifically helps with command-not-found
RUN rm -f /etc/apt/apt.conf.d/docker-gzip-indexes /etc/apt/apt.conf.d/docker-no-languages

# Restore documentation but do not upgrade all packages, that's not appropriate;
# Install ubuntu-minimal & ubuntu-standard
# Install extra packages as well as libnss-myhostname
COPY extra-packages /
RUN sed -Ei '/apt-get (update|upgrade)/s/^/#/' /usr/local/sbin/unminimize && \
apt-get update && \
yes | /usr/local/sbin/unminimize && \
DEBIAN_FRONTEND=noninteractive apt-get -y install \
ubuntu-minimal ubuntu-standard \
libnss-myhostname \
$(cat extra-packages | xargs) && \
rm -rd /var/lib/apt/lists/*
RUN rm /extra-packages

# Allow authentication with empty password, promptless
RUN sed -i '/^auth.*pam_unix.so/s/nullok_secure/try_first_pass nullok/' /etc/pam.d/common-auth

# Fix empty bind-mount to clear selinuxfs (see #337)
RUN mkdir -p /usr/share/empty

CMD /bin/sh
Empty file added images/ubuntu/20.04/README.md
Empty file.
9 changes: 9 additions & 0 deletions images/ubuntu/20.04/extra-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

git
keyutils
gnupg2
tree
unzip
zip
zsh
curl

0 comments on commit 5302f7c

Please sign in to comment.