Skip to content

Commit

Permalink
Merge pull request #136 from fdupoux/dockerfile
Browse files Browse the repository at this point in the history
Added dockerfile to build fsarchiver
  • Loading branch information
fdupoux authored Mar 19, 2023
2 parents f7bfe34 + 2932b72 commit 51e3dad
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docker/Dockerfile-archlinux
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM archlinux:latest
RUN mkdir -p /workspace
RUN pacman -Syyu --noconfirm autoconf automake gcc git make patch pkgconf && rm -rf /var/cache/pacman/pkg/*
RUN pacman -Syyu --noconfirm bzip2 e2fsprogs lzo xz libgcrypt zlib lz4 zstd && rm -rf /var/cache/pacman/pkg/*
CMD ["/usr/bin/bash"]
WORKDIR /workspace
17 changes: 17 additions & 0 deletions docker/build-docker-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

if [ -z ${DOCKER_CMD+x} ]; then
# $DOCKER_CMD is not set -> use the default
DOCKER_CMD=docker
fi

# Determine the path to the git repository
fullpath="$(realpath $0)"
curdir="$(dirname ${fullpath})"
repodir="$(realpath ${curdir}/..)"
echo "fullpath=${fullpath}"
echo "repodir=${repodir}"

# Build the docker image
dockerimg="fsarchiver-builder:latest"
"$DOCKER_CMD" build -t ${dockerimg} -f ${repodir}/docker/Dockerfile-archlinux ${repodir}/docker
31 changes: 31 additions & 0 deletions docker/build-fsarchiver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

if [ -z ${DOCKER_CMD+x} ]; then
# $DOCKER_CMD is not set -> use the default
DOCKER_CMD=docker
fi

# Make sure the docker image exists
dockerimg="fsarchiver-builder:latest"
if ! "$DOCKER_CMD" inspect ${dockerimg} >/dev/null 2>/dev/null ; then
echo "ERROR: You must build the following docker image before you run this script: ${dockerimg}"
exit 1
fi

# Determine the path to the git repository
fullpath="$(realpath $0)"
curdir="$(dirname ${fullpath})"
repodir="$(realpath ${curdir}/..)"
echo "curdir=${curdir}"
echo "repodir=${repodir}"

# Build fsarchiver in docker
docker run --rm --user 1000:1000 -it \
--volume=${repodir}:/workspace \
${dockerimg} setarch x86_64 -- bash -c "make distclean ; ./autogen.sh && ./configure && make && make dist"
res=$?
if [ ${res} -ne 0 ]
then
echo "ERROR: Failed to build fsarchiver"
exit 1
fi

0 comments on commit 51e3dad

Please sign in to comment.