-
Notifications
You must be signed in to change notification settings - Fork 33
/
build.sh
executable file
·43 lines (32 loc) · 1.25 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash -x
set -ex
ctr=$(buildah from registry.fedoraproject.org/fedora:35)
rpms=(
make gcc ruby ruby-devel redhat-rpm-config # for building gems
gcc-c++ # for building unf_ext
libvirt-devel # for building ruby-libvirt gem
zlib-devel # for building nokogiri gem
git # for the git ls-files in gemspec file
bsdtar # used by vagrant to unpack box files
)
WORKINGDIR='/tmp/workingdir/'
# Set working directory
buildah config --workingdir $WORKINGDIR $ctr
# Get all updates and install needed rpms
buildah run $ctr -- dnf update -y
buildah run $ctr -- dnf install -y ${rpms[@]}
# Add source code
buildah add $ctr './' $WORKINGDIR
# Install bundler
buildah run $ctr -- gem install bundler
# Install all needed gems
buildah run $ctr -- bundle install --with plugins
# Install all needed gems
buildah run $ctr -- bundle exec rake build
# Copy built files outside of container
mount=$(buildah mount $ctr)
package=$(ls $mount/$WORKINGDIR/pkg/vagrant-sshfs-*gem)
echo "copying to ./$(basename $package)"
cp $package ./
buildah umount $ctr
echo "Built package is at ./$(basename $package)"