summaryrefslogtreecommitdiffstats
path: root/build/buildah-remote.sh
blob: 1016d192f4e907273a1e7b3f3f515c9a8145a154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#! /usr/bin/env bash

set -o errexit

image="$1"
[ -n "$image" ] || { echo "Usage: $0 <astra|ccpi|ufo|tomo|imageX>"; exit 1; }

container=$(buildah from ${image}:latest)
buildah config --port 2222/tcp --port 8888/tcp $container

buildah run $container sh -c "echo '$(id -ng):x:$(id -g):' >> /etc/group"
#buildah run $container sh -c "echo '$(id -nu):x:$(id -u):$(id -g):$(id -nu):/ccpi/data:/bin/bash' >> /etc/passwd"
buildah run $container sh -c "echo '$(id -nu):x:0:0:$(id -nu):/ccpi/data:/bin/bash' >> /etc/passwd"

buildah run $container sh -c 'service ssh start'
buildah run $container sh -c "echo '$(id -nu):test' | chpasswd"

buildah commit --format docker $container ${image}-remote:latest

echo "$container build from ${image} and saved as ${image}-remote"