mirror of
https://github.com/falk-werner/webfuse-provider
synced 2024-10-27 20:44:10 +00:00
adds initial multi-platform docker build support
This commit is contained in:
parent
95e4d96d79
commit
2a14c2a6cf
115
Makefile
Normal file
115
Makefile
Normal file
@ -0,0 +1,115 @@
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
|
||||
.PHONY: default
|
||||
default: all
|
||||
|
||||
## Overridable defaults
|
||||
|
||||
$(VERBOSE)SILENT ?= @
|
||||
PROJECT_ROOT ?= .
|
||||
OUT ?= $(PROJECT_ROOT)/.build
|
||||
VERSION ?= $(shell cat $(PROJECT_ROOT)/VERSION)
|
||||
NPROC ?= $(shell nproc)
|
||||
DOCKER ?= docker
|
||||
DOCKER_RUNUSER ?= $(shell id -u)
|
||||
DOCKER_RUNGROUP ?= $(shell id -g)
|
||||
|
||||
UBUNTU_CODENAME ?= bionic
|
||||
|
||||
MARCH_AMD64 := $(filter-out amd64,$(MARCH))
|
||||
MARCH_ARM32V7 := $(filter-out arm32v7,$(MARCH))
|
||||
|
||||
## Defaults
|
||||
|
||||
$(MARCH_AMD64)TARGETS += wsfs-builder-amd64-ubuntu
|
||||
$(MARCH_ARM32V7)TARGETS += wsfs-builder-arm32v7-ubuntu
|
||||
|
||||
DOCKER_RUNFLAGS += --interactive
|
||||
DOCKER_RUNFLAGS += --rm
|
||||
DOCKER_RUNFLAGS += --tty
|
||||
DOCKER_RUNFLAGS += --init
|
||||
DOCKER_RUNFLAGS += --user $(DOCKER_RUNUSER):$(DOCKER_RUNGROUP)
|
||||
DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined
|
||||
DOCKER_RUNFLAGS += --env SOURCE_DATE_EPOCH
|
||||
|
||||
DOCKER_BUILDARGS += CODENAME=$(CODENAME)
|
||||
DOCKER_BUILDARGS += NPROC=$(NPROC)
|
||||
|
||||
DOCKER_BUILDFLAGS += $(addprefix --build-arg ,$(DOCKER_BUILDARGS))
|
||||
|
||||
OUT_DIRS += $(OUT)
|
||||
OUT_DIRS += $(OUT)/docker
|
||||
OUT_DIRS += $(addprefix $(OUT)/,$(TARGETS))
|
||||
|
||||
PROJECT_RESOURCES = $(call glob_files,$(PROJECT_ROOT)/**)
|
||||
|
||||
ALL_TARGETS += $(addprefix compile-,$(TARGETS))
|
||||
CHECK_TARGETS += $(addprefix check-,$(TARGETS))
|
||||
CONFIGURE_TARGETS += $(addsuffix /CMakeCache.txt,$(addprefix $(OUT)/,$(TARGETS)))
|
||||
|
||||
## Helper macros
|
||||
|
||||
# $(call glob,include_pattern...,exclude_regex...,flags...)
|
||||
glob = $(shell bash -c 'shopt -s globstar nullglob && find $1 -maxdepth 0 $3 | grep -v $(addprefix -e, $2)')
|
||||
# $(call glob_files,include_pattern...,exclude_regex...)
|
||||
glob_files = $(call glob,$1,^$(OUT) $2,-type f)
|
||||
|
||||
## Force eager evaluation
|
||||
|
||||
DOCKER_RUNGROUP := $(DOCKER_RUNGROUP)
|
||||
VERSION := $(VERSION)
|
||||
PROJECT_ROOT := $(PROJECT_ROOT)
|
||||
OUT := $(OUT)
|
||||
|
||||
## Special targets
|
||||
|
||||
.PRECIOUS: $(OUT)/docker/%
|
||||
.DELETE_ON_ERROR: $(OUT)/%/CMakeCache.txt $(OUT)/docker/%
|
||||
|
||||
## Targets
|
||||
|
||||
.PHONY: all
|
||||
all: $(ALL_TARGETS)
|
||||
|
||||
.PHONY: check
|
||||
check: $(CHECK_TARGETS)
|
||||
|
||||
.PHONY: clean
|
||||
clean: $(CLEAN_TARGETS)
|
||||
$(SILENT)-rm -rf $(OUT_DIRS)
|
||||
|
||||
.PHONY: configure
|
||||
configure: $(CONFIGURE_TARGETS)
|
||||
|
||||
%-ubuntu: CODENAME := $(UBUNTU_CODENAME)
|
||||
|
||||
$(OUT)/docker/%: $(PROJECT_ROOT)/docker/%.dockerfile $(PROJECT_RESOURCES) | $(OUT_DIRS)
|
||||
$(SILENT)$(DOCKER) build --rm $(DOCKER_BUILDFLAGS) --iidfile $@ --file $< --tag $*:$(VERSION) $(dir $<)
|
||||
|
||||
$(OUT)/%/CMakeCache.txt: $(PROJECT_ROOT)/CMakeLists.txt $(OUT)/docker/% | $(OUT_DIRS)
|
||||
$(SILENT)$(DOCKER) run $(DOCKER_RUNFLAGS) \
|
||||
--volume '$(realpath $(PROJECT_ROOT)):/tmp' \
|
||||
--volume '$(realpath $(dir $@)):/tmp/out' \
|
||||
--workdir /tmp/out \
|
||||
$*:$(VERSION) \
|
||||
cmake -GNinja $(CMAKEFLAGS) .. && touch $@
|
||||
|
||||
$(CHECK_TARGETS): GLOAS := test
|
||||
$(CHECK_TARGETS): DOCKER_RUNUSER := test
|
||||
|
||||
check-%: compile-%;
|
||||
|
||||
compile-%: $(OUT)/%/CMakeCache.txt
|
||||
$(SILENT)$(DOCKER) run $(DOCKER_RUNFLAGS) \
|
||||
--volume '$(realpath $(PROJECT_ROOT)):/tmp' \
|
||||
--volume '$(realpath $(dir $^)):/tmp/out' \
|
||||
--workdir /tmp/out \
|
||||
$*:$(VERSION) \
|
||||
ninja -j$(NPROC) $(GLOAS)
|
||||
|
||||
$(OUT_DIRS):
|
||||
$(SILENT)mkdir -p $@
|
||||
|
||||
debug-print-%:
|
||||
@printf '%s\n' '$*:' $($*)
|
||||
|
@ -298,7 +298,7 @@ By default, unit tests and example application are enabled. You can disable them
|
||||
- [Jansson](https://jansson.readthedocs.io)
|
||||
- [GoogleTest](https://github.com/google/googletest) *(optional)*
|
||||
|
||||
### Installation
|
||||
### Installation from source
|
||||
|
||||
#### libfuse
|
||||
|
||||
@ -323,12 +323,6 @@ By default, unit tests and example application are enabled. You can disable them
|
||||
|
||||
#### Jansson
|
||||
|
||||
On many systems, libjansson can installed via apt:
|
||||
|
||||
sudo apt install libjansson-dev
|
||||
|
||||
Otherwise, it can be installed from source:
|
||||
|
||||
wget -O libjansson-2.12.tar.gz https://github.com/akheron/jansson/archive/v2.12.tar.gz
|
||||
tar -xf libjansson-2.12.tar.gz
|
||||
cd jansson-2.12
|
||||
|
BIN
docker/qemu-arm-static
Executable file
BIN
docker/qemu-arm-static
Executable file
Binary file not shown.
75
docker/wsfs-builder-amd64-ubuntu.dockerfile
Normal file
75
docker/wsfs-builder-amd64-ubuntu.dockerfile
Normal file
@ -0,0 +1,75 @@
|
||||
ARG CODENAME=bionic
|
||||
|
||||
FROM ubuntu:$CODENAME
|
||||
|
||||
RUN set -x \
|
||||
&& apt update \
|
||||
&& apt install --yes --no-install-recommends \
|
||||
openssl \
|
||||
ca-certificates \
|
||||
curl \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
gcc-multilib \
|
||||
g++-multilib \
|
||||
pkg-config
|
||||
|
||||
ARG NPROC=1
|
||||
ARG GTEST_VERSION=1.8.1
|
||||
|
||||
RUN set -x \
|
||||
&& curl -fSL https://github.com/google/googletest/archive/release-$GTEST_VERSION.tar.gz -o /tmp/gtest-$GTEST_VERSION.tar.gz \
|
||||
&& tar -C /tmp -xf /tmp/gtest-$GTEST_VERSION.tar.gz \
|
||||
&& ( cd /tmp/googletest-release-$GTEST_VERSION \
|
||||
&& cmake . \
|
||||
&& make -j$NPROC install) \
|
||||
&& rm /tmp/gtest-$GTEST_VERSION.tar.gz \
|
||||
&& rm -rf /tmp/googletest-release-$GTEST_VERSION
|
||||
|
||||
ARG FUSE_VERSION=3.1.1
|
||||
|
||||
RUN set -x \
|
||||
&& apt update \
|
||||
&& apt install --yes --no-install-recommends \
|
||||
libtool \
|
||||
automake \
|
||||
gettext \
|
||||
&& curl -fSL https://github.com/libfuse/libfuse/archive/fuse-$FUSE_VERSION.tar.gz -o /tmp/fuse-$FUSE_VERSION.tar.gz \
|
||||
&& tar -C /tmp -xf /tmp/fuse-$FUSE_VERSION.tar.gz \
|
||||
&& ( cd /tmp/libfuse-fuse-$FUSE_VERSION \
|
||||
&& ./makeconf.sh \
|
||||
&& ./configure \
|
||||
&& make -j$NPROC install) \
|
||||
&& rm /tmp/fuse-$FUSE_VERSION.tar.gz \
|
||||
&& rm -rf /tmp/libfuse-fuse-$FUSE_VERSION
|
||||
|
||||
ARG WEBSOCKETS_VERSION=3.1.0
|
||||
|
||||
RUN set -x \
|
||||
&& apt install --yes --no-install-recommends \
|
||||
libssl-dev \
|
||||
&& curl -fSL https://github.com/warmcat/libwebsockets/archive/v$WEBSOCKETS_VERSION.tar.gz -o /tmp/libwebsockets-$WEBSOCKETS_VERSION.tar.gz \
|
||||
&& tar -C /tmp -xf /tmp/libwebsockets-$WEBSOCKETS_VERSION.tar.gz \
|
||||
&& ( cd /tmp/libwebsockets-$WEBSOCKETS_VERSION \
|
||||
&& cmake . \
|
||||
&& make -j$NPROC install) \
|
||||
&& rm /tmp/libwebsockets-$WEBSOCKETS_VERSION.tar.gz \
|
||||
&& rm -rf /tmp/libwebsockets-$WEBSOCKETS_VERSION
|
||||
|
||||
ARG JANSSON_VERSION=2.12
|
||||
|
||||
RUN set -x \
|
||||
&& curl -fSL https://github.com/akheron/jansson/archive/v$JANSSON_VERSION.tar.gz -o /tmp/libjansson-$JANSSON_VERSION.tar.gz \
|
||||
&& tar -C /tmp -xf /tmp/libjansson-$JANSSON_VERSION.tar.gz \
|
||||
&& ( cd /tmp/jansson-$JANSSON_VERSION \
|
||||
&& cmake . \
|
||||
&& make -j$NPROC install) \
|
||||
&& rm /tmp/libjansson-$JANSSON_VERSION.tar.gz \
|
||||
&& rm -rf /tmp/jansson-$JANSSON_VERSION
|
||||
|
||||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
|
||||
|
||||
RUN useradd -ms /bin/bash test
|
||||
|
||||
|
77
docker/wsfs-builder-arm32v7-ubuntu.dockerfile
Normal file
77
docker/wsfs-builder-arm32v7-ubuntu.dockerfile
Normal file
@ -0,0 +1,77 @@
|
||||
ARG CODENAME=bionic
|
||||
|
||||
FROM arm32v7/ubuntu:$CODENAME
|
||||
|
||||
COPY qemu-arm-static /usr/bin/
|
||||
|
||||
RUN set -x \
|
||||
&& apt update \
|
||||
&& apt install --yes --no-install-recommends \
|
||||
openssl \
|
||||
ca-certificates \
|
||||
curl \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
gcc-multilib \
|
||||
g++-multilib \
|
||||
pkg-config
|
||||
|
||||
ARG NPROC=1
|
||||
ARG GTEST_VERSION=1.8.1
|
||||
|
||||
RUN set -x \
|
||||
&& curl -fSL https://github.com/google/googletest/archive/release-$GTEST_VERSION.tar.gz -o /tmp/gtest-$GTEST_VERSION.tar.gz \
|
||||
&& tar -C /tmp -xf /tmp/gtest-$GTEST_VERSION.tar.gz \
|
||||
&& ( cd /tmp/googletest-release-$GTEST_VERSION \
|
||||
&& cmake . \
|
||||
&& make -j$NPROC install) \
|
||||
&& rm /tmp/gtest-$GTEST_VERSION.tar.gz \
|
||||
&& rm -rf /tmp/googletest-release-$GTEST_VERSION
|
||||
|
||||
ARG FUSE_VERSION=3.1.1
|
||||
|
||||
RUN set -x \
|
||||
&& apt update \
|
||||
&& apt install --yes --no-install-recommends \
|
||||
libtool \
|
||||
automake \
|
||||
gettext \
|
||||
&& curl -fSL https://github.com/libfuse/libfuse/archive/fuse-$FUSE_VERSION.tar.gz -o /tmp/fuse-$FUSE_VERSION.tar.gz \
|
||||
&& tar -C /tmp -xf /tmp/fuse-$FUSE_VERSION.tar.gz \
|
||||
&& ( cd /tmp/libfuse-fuse-$FUSE_VERSION \
|
||||
&& ./makeconf.sh \
|
||||
&& ./configure \
|
||||
&& make -j$NPROC install) \
|
||||
&& rm /tmp/fuse-$FUSE_VERSION.tar.gz \
|
||||
&& rm -rf /tmp/libfuse-fuse-$FUSE_VERSION
|
||||
|
||||
ARG WEBSOCKETS_VERSION=3.1.0
|
||||
|
||||
RUN set -x \
|
||||
&& apt install --yes --no-install-recommends \
|
||||
libssl-dev \
|
||||
&& curl -fSL https://github.com/warmcat/libwebsockets/archive/v$WEBSOCKETS_VERSION.tar.gz -o /tmp/libwebsockets-$WEBSOCKETS_VERSION.tar.gz \
|
||||
&& tar -C /tmp -xf /tmp/libwebsockets-$WEBSOCKETS_VERSION.tar.gz \
|
||||
&& ( cd /tmp/libwebsockets-$WEBSOCKETS_VERSION \
|
||||
&& cmake . \
|
||||
&& make -j$NPROC install) \
|
||||
&& rm /tmp/libwebsockets-$WEBSOCKETS_VERSION.tar.gz \
|
||||
&& rm -rf /tmp/libwebsockets-$WEBSOCKETS_VERSION
|
||||
|
||||
ARG JANSSON_VERSION=2.12
|
||||
|
||||
RUN set -x \
|
||||
&& curl -fSL https://github.com/akheron/jansson/archive/v$JANSSON_VERSION.tar.gz -o /tmp/libjansson-$JANSSON_VERSION.tar.gz \
|
||||
&& tar -C /tmp -xf /tmp/libjansson-$JANSSON_VERSION.tar.gz \
|
||||
&& ( cd /tmp/jansson-$JANSSON_VERSION \
|
||||
&& cmake . \
|
||||
&& make -j$NPROC install) \
|
||||
&& rm /tmp/libjansson-$JANSSON_VERSION.tar.gz \
|
||||
&& rm -rf /tmp/jansson-$JANSSON_VERSION
|
||||
|
||||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
|
||||
|
||||
RUN useradd -ms /bin/bash test
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user